Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:38:04+00:00 2026-06-04T13:38:04+00:00

In my code, I want the two answers ‘Opposite’ and ‘Hypotenuse,’ to have two

  • 0

In my code, I want the two answers ‘Opposite’ and ‘Hypotenuse,’ to have two separate outcomes, however, whenever I test the code and answer, ‘opposite,’ it ignores the rest of the code and goes down to the ‘hypotenuse’ questions. Have I formatted it wrong/is there a simpler way to do this/etc.?

from math import *

    def  main():

       #Trignometry Problem

        def answer():
            answer = raw_input()

    while True:

        # Phrase Variables
        phrase1 = ("To begin, we will solve a trigonometry problem using sin.")
        phrase2 = ("Which is known - hypotenuse or opposite?")
        phrase3 = ("Good! Now, we will begin to solve the problem!")
        phrase4 = ("Please press any key to restart the program.")

        print phrase1
        origin=input("What is the origin?")
        print phrase2
        answer = raw_input()
        if answer == ("Hypotenuse.") or ("Hypotenuse") or ("hypotenuse") or ("hyotenuse."):
            hypotenuse=input("What is the hypotenuse?")
            print "So, the problem is " + "sin" + str(origin) + " = " + "x" + "/" + str(hypotenuse) + "?"
            answer = raw_input()
            if answer == ("Yes.") or ("yes") or ("yes.") or ("Yes"):
                print phrase2
            answer = raw_input()
            print phrase4
            answer = raw_input()
            if answer == ("No."):
                break 
        if answer == ("Opposite."):
            opposite=input("What is the opposite?")
            print "So, the problem is " + "sin" + str(origin) +  " = " + str(opposite) + "/" + "x" + "?"
            answer = raw_input()
            if answer == ("Yes.") or ("yes") or ("yes.") or ("Yes"):
                print phrase2
        answer = raw_input()
        print phrase4
        answer = raw_input()
        if answer == ("No."):
            break


    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:38:05+00:00Added an answer on June 4, 2026 at 1:38 pm

    Short answer

    You probably want to change those:

    if answer == ("Hypotenuse") or ("Hypotenuse.") ...
    

    By this:

    if answer in ("Hypotenuse", "Hypotenuse.", ...):
    

    Explanation

    The expression:

    answer == ("Foo") or ("Bar")
    

    It is evaluated like:

    (answer == ("Foo")) or (("Bar"))
    

    And "Bar" is always True.

    Obviously, as pointed out in the comments, "HYPOTENUSE" in answer.upper() is the best solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code, I have two checkboxes and want to keep one disabled
In my code I want to send two parameters in my data. Name is
First of all I want to mention two things, One: My code isn't perfect
I want code to run whenever I create a new object. For example, see
I want to Animate two Different layouts. Example I already have the animation the
I want to use two independent $_SESSIONs in a single PHP script. I have
Suppose I have some code, struct NodeVector { vector<bool_node*> *vec; }; I want to
I have such code: a = [[1, 1], [2, 1], [3, 0]] I want
I want to perform Digital Mixing of two audio files. I have used MixerHost-
I have two related Python 'import' questions. They are easily testable, but I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.