Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
For example :-
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)
x=input().lower()
print('abc' in x or 'def' in x)
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)
The output should be the number of digits the squared integer has.
For Example:
Input:
8
Output:
2
Input:
14
Output:
3
x=int(input())
l=str(x*x)
print(len(l))
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())
For Example:
Input:
4
Output:
False
x=int(input())
if x%2==0:
print('False')
else:
print('True')
if x%2==0:
print('True')
else:
print('False')