The original float data type, you need to pass in two int'a. How do I output the number after the dot?

There is a variable of type float in which we introduce the price of the format "RUB. COP." Need to bring in two integer variables, the value of the goods in the form of a whole number of rubles and whole number of cents.

Ie introduced 4.99 and get 4 99.

Until we have code like this. Please tell me how to get the number after the dot?

x = float(input())

kop = #help! 
rub = int(x)

print(us$, int(kop))


About the restrictions: no loops and conditional statements
June 14th 19 at 20:04
2 answers
June 14th 19 at 20:06
Solution
x = float(input())

rub = int(x // 1)
kop = int(round((x - rub)*100, 2))

print(rub, kop)


Under this option, we have the following:

4.99 as 4 99
10.35 10 35

ie seems to be round all the problem numbers as necessary
June 14th 19 at 20:08
sum_ = 2.99
ruble = sum_ // 1
kopey = int((sum_ - ruble)*100)
almost, for the number 10.35
in this variant will come out 10 34

I have a similar decision myself pile)) - Charit commented on June 14th 19 at 20:11
print(*list(int(x) for x in str(4.99).split('.'))) - alexandro_Auer commented on June 14th 19 at 20:14
excuse me, I forgot to clarify about the restrictions: no loops and conditional statements :) - Charit commented on June 14th 19 at 20:17
, reduce complacency.
x = 10.35
print(*divmod(int(round(x * 100)), 100))
- Benedict_Shiel commented on June 14th 19 at 20:20
,
rub, kop = str(4.99).split('.')
print(int(rub), int(kop)) - alexandro_Auer commented on June 14th 19 at 20:23
well I unlike you are not hammered in idle, and wrote from memory - Sonny.Skiles commented on June 14th 19 at 20:26
, my compliments :) - Charit commented on June 14th 19 at 20:29

Find more questions by tags Python