+ 11
[CHALLENGE] decimal part
hello sololearners the idea is so sample create a program which takes a float as input then it calculates the decimal part ex: input : 3.14 output : 14 input : 4 output : 0 good luck😋😋😋
11 Réponses
+ 17
https://code.sololearn.com/Woqh1ocHzKAR/?ref=app
https://code.sololearn.com/c7iLJeJgv9uK/?ref=app
https://code.sololearn.com/ct1o82EUecBY/?ref=app
https://code.sololearn.com/chTeHfoTZzHe/?ref=app
+ 12
# Python
print(input().split('.')[1])
+ 11
Great Challenge!
https://code.sololearn.com/cIC9yJePFYzw/?ref=app
+ 8
Coder++ Enter a floating point number and see both the integer part and the fractional part displayed.
https://code.sololearn.com/W8DZH4tNqd9D/?ref=app
+ 4
https://code.sololearn.com/WEbR6cDC829f/?ref=app
+ 3
https://code.sololearn.com/coMYG9Tmjq77/
I decided to look at others' projects after I finished mine. I must say, not bad at all. I hope you enjoy comments because mine has a lot.
+ 2
Python:
my_float = float(input('Give me a float: '))
print(int((my_float - int(my_float))*100))
https://code.sololearn.com/c4Ws0czX6WtA/#py
+ 1
سلام خوبی
0
without converting to string and a ‘true’ ;) python one-liner:
#assuming that input will always be a two-decimal point number
print((lambda x: int((x%int(x))*101))(float(input())))