I'm very new to Python, please help.
I can only use if else statements, no loops or anything special like that.
This program asks the user for one string. It counts the number of different digits in the string. for example a11111a1a1 contains a single digit, while a1s2d1d2d1d2d1 contains 2 digits.
Examples:
% python3 countNumbers.py
enter string: qwerty
there are no digits in string: "qwerty"
% python3 countNumbers.py
enter string: asdf1sdfg
there is one digit in string: "asdf1sdfg"
% python3 countNumbers.py
enter string: as1as2as333333
there are 3 different digits in string: "as1as2as333333"
% python3 countNumbers.py
enter string: a0123456789x
there are 10 different digits in string: "a0123456789x"
num = input("enter string: ")
count = 0
if "0" in num:
count = count + 1
if "1" in num:
count = count + 1
if "2" in num:
count = count + 1
if "3" in num:
count = count + 1
if "4" in num:
count = count + 1
if "5" in num:
count = count + 1
if "6" in num:
count = count + 1
if "7" in num:
count = count + 1
if "8" in num:
count = count + 1
if "9" in num:
count = count + 1
if count >= 1:
print("there is one digit in string: ", num)
elif count >= 2:
print("there are two digits in string: ", num)
else:
print("there are no digits in string: ", num)