Write a program that accepts a number as input, and prints just the decimal portion. Your program must account for negative numbers.
1
Expert's answer
2019-12-19T14:38:36-0500
Decided this way
try:
num = float(input("Insert the number: "))
res = str(num)
print("Fractional portion:", res[res.find('.')+1:])
except:
print("ERROR! This is not a number!")
Comments
Leave a comment