Feb-16-2020, 07:15 PM
Hi, I'm having a problem with the code that I'm writing, this may be obvious as I'm new to Python, when I try to input a decimal whil writing my code I receive an error message, here is my code:
r = int(input("Enter the length of the row, in feet:")) e = int(input("Enter the amount of space, in feet, used by an end-post assembly:")) s = int(input("Enter the distance, in feet, between each vine:")) v = ((r-2*e)/s) print ("You have enough space for", v, "vines.")This code works fine when I use numbers which are not decimals, however, I attempted to use a decimal while running it and this happened:
Enter the length of the row, in feet:100 Enter the amount of space, in feet, used by an end-post assembly:0.5 Traceback (most recent call last): File "C:\Users\Windows\AppData\Local\Programs\Python\Python38-32\Assignement 1.py", line 4, in <module> e = int(input("Enter the amount of space, in feet, used by an end-post assembly:")) ValueError: invalid literal for int() with base 10: '0.5' >>>I'm confused as the why I can't use a decimal, again this is probably obvious but I'm new to this, thank you.