Python Forum
I'm getting a syntax error very early on in my code and I can't quite figure it out.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm getting a syntax error very early on in my code and I can't quite figure it out.
#1
This is my freshman year in college and I had to take a python course. It hasn't been to easy with all reote classes. the goal of this program is for the user to input two agess of dogs in human years and to get back their ages and a specified response.
this is my code so far:
humanage = int(input("please enter your dog's age in human years")
            if humanage <= 2:
             dogage = humanage * 10.5
            else:
               dogage = 21 + (humanage - 2)*4

humanage2 = int(input("please enter your other dog's age in human years")
                if humanage2 <= 2:
                dogage2 = humanage * 10.5
            else:
                dogage = 21 + (humanage2 - 2)*4
        print("your first dog's age in dog years is", dogage)
        print("your second dog's age in dog years is", dogage2)
    if dogage == dogage2:
                print("friends from birth")
            elif dogage > dogage2 or dogage > 50:
                print("senior")
            elif dogage > 35 and dogage2 > 35:
                print("they could be president")
            elif dogage2 < 2:
                print("it's a puppy")
            else:
                print("cats are better anyways")
If anyone could help I would very much appreciate it!
Larz60+ write Oct-30-2020, 02:34 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Added for you this time. Please use tags in future posts.
Reply


Messages In This Thread
I'm getting a syntax error very early on in my code and I can't quite figure it out. - by liloliveoil - Oct-30-2020, 02:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Shocked School project -- need help with it it says syntax error XPGKNIGHT 6 3,358 Aug-11-2022, 08:43 PM
Last Post: deanhystad
  Unspecified syntax error hhydration 1 2,038 Oct-25-2020, 10:45 AM
Last Post: ibreeden
  Annuity function for school - syntax error peterp 2 2,008 Oct-12-2020, 10:34 PM
Last Post: jefsummers
  Invalid syntax error, where? tucktuck9 2 3,446 May-03-2020, 09:40 AM
Last Post: pyzyx3qwerty
  Raise an exception for syntax error sbabu 8 3,245 Feb-10-2020, 01:57 AM
Last Post: sbabu
  syntax error: can't assign to operator liam 3 4,080 Jan-25-2020, 03:40 PM
Last Post: jefsummers
  Self taught , (creating a quiz) syntax error on my array DarkAlchemyXEX 9 4,353 Jan-10-2020, 02:30 AM
Last Post: ichabod801
  If Statements and Comparisons returns a syntax error DarkAlchemyXEX 2 2,473 Jan-02-2020, 01:25 PM
Last Post: DarkAlchemyXEX
  Syntax Error: Invalid Syntax in a while loop sydney 1 4,113 Oct-19-2019, 01:40 AM
Last Post: jefsummers
  syntax error in an if statement at the else ? Just_started 2 2,260 Mar-07-2019, 08:35 PM
Last Post: Just_started

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020