Apr-13-2017, 06:57 AM
You are getting the reminder on line 15 and print it. Not the tens
#request input from the user num=eval(input("please enter an integer in the range 0....9999")) if num<0: num=0 if num>9999: num=9999 print(end="[") #extract and print thousand place digit digit=num//1000 print(digit,end=" ") num%=1000 #extract and print hundred place digit digit=num//100 print(digit,end=" ") digit = num // 10 # added print(digit, end=' ') #added num%=10 #remainder is the one place digit print(num,end=" ") print("]")You should never use eval() to get a number as an input. It's very dangerous if one's input is a valid Python code. It will be executed
num = int(input("Enter a number between 1 and 9999: "))