-1
So I’m learning Python from the video course and I’m in class 9, Ex23, and I’m trying (in a mathematical way) to show the numbers divided to the person, only he’s wrong, and I have no idea what to do here, and even with Pycharm telling me that something’s wrong, I don’t understand what’s wrong:
Nam = input(int('Qual o numero (de 1 ate 9999)?'))
M = (Nam//1000)
C = Nam-(M*1000)
C = C//100
D = Nam-((M*1000)+(C*100))
D = D//10
lol = Nam-((M*1000)+(C*100)+(D*10))
print(M)
print(C)
print(D)
print(lol)
Pycharm keeps telling me there’s something wrong with "Nam," but I don’t know what it is
Would not be:
Nam = int(input('Qual o numero (de 1 ate 9999)?'))
, reads a string and converts what was read to int?– anonimo
int('texto')
tries to convert the text to number, and since the text "Which is the number etc" is not a number, gives error. It is right to first get the text from theinput
and then try to convert to number (ie,int(input(texto))
, as stated above)– hkotsubo