Apr-13-2017, 05:54 AM
according to me this program output should be [0 0 6 2],but output is [0 0 2],why
#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=" ") num%=10 #remainder is the one place digit print(num,end=" ") print("]")
Moderator Larz60+: Added Python tags. Please do this in the future (see help, BBCODE)