Sei sulla pagina 1di 5

Write a python script which will -

 Take a string from the user as input


 Print the number of vowels in the input string.

For example :-

1. For given input string -


2. aeiou
3.

The output should be -


5

4. For given input string -


5. AaEeIiOoUu
6.

The output should be -


10

x=input()

c=0

for i in x:

if i in ['a','e','i','o','u']:

c=c+1

if i in ['A','E','I','O','U']:

c=c+1

print(c)

Write a python script which will -


 Take a string from the user as input
 Check if the input string has substring abc or def in it.
 If it does, print True, else print False

x=input().lower()

print('abc' in x or 'def' in x)

Write a python script which will -


 Take a Two digit integer from the user as input
 Individually print the digits of this number

x=int(input())

o=x%10

t=x//10

print(t)

print(o)

t*10+o==x

Write a python script to accept a name (use an empty prompt) and then print
the string "hello NAME"

For Example;
Input:
Batman
Output:
hello Batman
x=input()

print("hello",x)

Write a python script to accept a name but also give them a prompt:
"Please enter your name: " and then print the string "hello NAME"

For Example;
Input:
Please enter your name: Batman
Output:
hello Batman
x=input("Please enter your name: " )

print("hello",x)

Write a script that accepts a single integer as input and provides the square of
the integer as output.
For Example;
Input:
4
Output:
16
x=int(input())

print(x*x)

Write a script that:


 Accepts a single integer as input (Use an empty prompt)
 Squares this integer

The output should be the number of digits the squared integer has.

For Example:

Input:
8
Output:
2
Input:
14
Output:
3

from __future__ import print_function

x=int(input())

l=str(x*x)

print(len(l))

Write a python script to accept a single complex number as input.


The script output should;
 Print the coefficient values of the complex number
 Print the absolute value of this complex number
 Print the conjugate of this complex number

For Example:
Input:
1+2j

Output:
1.0 2.0
2.2360679775
(1-2j)

x=complex(input())

print(x.real,x.imag)

print(abs(x))

print(x.conjugate())

Write a script to accept an integer (use an empty prompt) as input.


The output should print True if the number is odd, otherwise print False

For Example:
Input:
4
Output:
False
x=int(input())

if x%2==0:

print('False')

else:

print('True')

Write a script that accepts an integer (use an empty prompt) as input.


The output should print True if the number is even, otherwise it should
print False
For Example:
Input:
8
Output:
True
x=int(input())

if x%2==0:

print('True')

else:

print('False')

Potrebbero piacerti anche