python - I have no idea what the error is? -


I am trying to create a converter which changes the dog year to human years and vice versa but if below Given I statement, I do not know, not to eliminate the code. I am using 3.4

  print ("This program changes the years of dog and cat as human year and vice versa") Print ("1. Dogs for human years Print "(" Human Years for 3 Years. ") Print (" 2. Years of the Year of the Year ") Print (" Human Years for 3 Years. ") (" 4. Years of Human Years. ") A = Input (" Choose one ") A = int (A) if a == 1: b = input (" how old your dog is ") d = int (b) b = int (B) if B & gt; 2: B = (D + 2) Z = (BD * 1) Y = (D-2 * 4) print = (Y + Z)  

Your problem is obvious print = (Y + Z) line, but this is not the biggest problem with your code. Give me a minute to write something and I will try to help.

The biggest problem that is easily fixed is that your variable name is A ? About a , b , b , d , Z , or Y ??? These are impossible variables to deal with, never do that.

As a rule of thumb, do you ever have to type code that you feel you have to maintain? Maybe not ... Let's put it another way ....

If the user of the stack overflow (or anywhere, or anywhere) looks at your code and "what happens in hell ? " So you are writing it wrong, it does not have much idea in programming as a fact. Whatever you write, someone else will have to maintain if they need to dig through your code to find out if it represents Z , then they will always have your name Curse.

Instead, make sure your variables are descriptive examples: - User = one = input ("choose one:") # & lt; - A = Input ("Select one:") user_in = int (user_in) # & lt; - a = int (a) ## Why not again? If user_in == 1: # that makes sense now! Age = input ("how old is your dog?") #You can do int (input ("prompt")) age = int (age) if age & gt; 2: dog_years = 2 + age - 8 # This evaluates your code. Print (dog_years) # Maybe this is math error?


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -