I am making a converting program in Python, and in this case it’s from feet to yards. I have having trouble with a specific line of code that is not showing an error message, yet refuses to actually work.
When I run the program and put the following numbers in the input (3, 2, 4, 1) the Yards should be 8, and the feet should be 0, but it stays on 7 yards, and doesn’t add the 3 extra feet into the yard amount.
firstYard = int(input("Enter the Yards: "))
firstFeet = int(input("Enter the Feet: "))
secondYard = int(input("Enter the Yards: "))
secondFeet = int(input("Enter the Feet: "))
print("Yards: ")
print(int(firstYard + secondYard))
print(" Feet: ")
print(int(firstFeet + secondFeet) % 3)
if ((firstFeet + secondFeet) % 3) > 2:
** firstYard += 1
**
The last line is what I’m having trouble with.
Yards = int(input("Enter the Yards: "))
Feet = int(input("Enter the Feet: "))
Yards_2 = int(input("Enter the Yards: "))
Feet_2 = int(input("Enter the Feet: "))
print("\nYards:",(Yards * 3 + Yards_2 * 3 + Feet + Feet_2) // 3, "Feet:",(Yards * 3 + Yards_2 * 3 + Feet + Feet_2) % 3)
You have to scroll to the right more. The feet should not exceed 2 because 3 feet would be a yard.