0

ive ben asked to make a program where the user inputs a floating number eg.(2.5)
and the program displays the 2 alone
and the .5 alone
ive ben trying for a while but gone nowhere

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by vegaseat
0

divmod( x, y)

Divides two numbers and returns the integer part of the result.

i see but what i need is ... ill show u and example

print "Enter The Floating Number"
F = input ()
(The user enter lets say 2.3 , then the program should display the 2 as the integer alone and the 3 as the decimal alone)

0

Okay here is a hint ...

float_number = 2.35
pre_point, post_point = divmod(float_number, 1)

print pre_point    # 2.0
print post_point   # 0.35
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.