I am trying to write a code that asks an User to Enter a decimal number, the my
program should separate the number in two parts like this:
1 cae:Enter a number: 12.9Decimal part: 12whole part : 9
2 case:Enter: 10Decimal par:Whole part: 10
That is my code:
A = input("Enter a number")
C = [ ] for i in str(A) :
C.append(i) if i ==".# period ": break aa= "".join(c)
print(aa, end =" ")
if i == int(A): print(" It is the whole part")
I can not display the whole part when I enter float number. Plus when I enter
an integer, it takes that enteger as a decimal number. Any help?
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor