[Tutor] Help
Abdur-Rahmaan Janhangeer
arj.python at gmail.com
Thu Sep 14 22:28:14 EDT 2017
besides already written notes,
i suggest
use .split(".")
floatNum = input("> ")
parts = floatNum.split(".")
whole = parts[0]
deci = parts[1]
Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com
On 7 Sep 2017 21:51, "edmundo pierre via Tutor" <tutor at python.org> wrote:
>
> 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 at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list