Ask coding questions

← Back to all posts
input a whole number, output a decimal number
bjwry12345 (0)

If the user inputs a value without decimal (example: 32, 12, 99,100), is there a way for the output to come out with a decimal point + 0?

input 32
Output 32.0

input 12

Answered by abc3354 (110) [earned 5 cycles]
View Answer
abc3354 (110)

Hi :)

You can use float()

Example [try it here] :

i = input()
f = float(i)

Replit helper here !
If you found my answer helpful, you can upvote it :)