Hi. Me again. I know I'm probably really annoying you all with my constant questions, but I just really suck at this. I've been working on this code for about 2 hours. Mind helping me out?
For this code, the computer gets an input that is a float and then has to give back the number that is directly after the decimal. Now, what I'm trying to do is make the float given into a list, and then print the number on the list that comes after the point, but I have no idea whatsoever how to do that. Is there a module of some type that would help me?
This is how my code looks like:
a = float(input())
num_list = list(str(a))
str_num = len(num_list)
Help me please?
There is a simpler way to approach this than what you are doing. Instead of finding the part after the decimal, find the part before the decimal (with
int) and then subtract it from the original number.
You can do 'split(".")' to split the float into the numbers before and after the decimal point.
#Get input as string
a = input()
#Split string around point
b = a.split(".")
#Print Part 2 (All objects after the point)