+ 3
How to write a program in pthon to ask the user to input a string and display how many characters are numeric and alphabet
pls help me to pass thes exam
4 ответов
+ 21
str=input('Pls input string: ')
print(len(str))
+ 2
It’s possible he was looking for something like this:
https://code.sololearn.com/clr23B1SHBce/?ref=app
+ 2
inp = input("\n")
print(inp)
alpha = 0
num = 0
for c in inp:
if '0' <= c <= '9':
num += 1
elif 'a' <= c <= 'z' or 'A' <= c <= 'Z':
alpha += 1
print('alpha: {}\nnum: {}'.format(alpha,num))
- 1
str = row _ input ("Enter a str:")
print (Len(str))