Question #100608

Write a program that accepts a number as input, and prints just the decimal portion. Your program must account for negative numbers.

Expert's answer

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!")
LATEST TUTORIALS
APPROVED BY CLIENTS