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 8794869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:18:35+00:00 2026-06-13T23:18:35+00:00

input(Would you like to read: comedy, political, philisophical, or tragedy?) a = comedy b

  • 0
input("Would you like to read: comedy, political, philisophical, or tragedy?")

a = "comedy"
b = "political"
c = "philisophical"
d = "tragedy"

if a:
    input("Would you like the author's nationality to be: English or French?")
    e = "French"
    d = "English"
    if e:
        print("Tartuffe")
    elif d:
        print("Taming of the Shrew")

When I run the program is just defaults to comedy and then to Tartuffe.
How do I get it to recognize the difference genres in the string?

  • 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-13T23:18:36+00:00Added an answer on June 13, 2026 at 11:18 pm

    you need to store the input and then compare it to what you want, for example:

    a = "comedy"
    b = "political"
    c = "philisophical"
    d = "tragedy"
    
    user_input = input("Would you like to read: comedy, political, philisophical, or tragedy?")
    
    if user_input == a:
        user_input = input("Would you like the author's nationality to be: English or French?")
    
        if user_input == e:
            #do more stuff
    

    A better way to do this (in my opinion) would be to do something like:

    def comedy():
        print("comedy")
    
    def political():
        print("political")
    
    def philisophical():
        print("philisophical")
    
    def tragedy():
        print("tragedy")
    
    types = {"comedy":comedy,
             "political":political,
             "philisophical":philisophical,
             "tragedy":tragedy
            }
    
    user_input = input()
    
    types[user_input]()
    

    because its easier to manage and read the different inputs.

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

Sidebar

Related Questions

I would like to read a text file and input its contents into an
I would like to know how can i read a value of input text
I would like to read coordinates from an from an input file. An example
I would like to read an input file in C++, for which the structure
I have an EditText input that I would like to only allow numbers 1
I would like to implement an input mask on Magento and that requires the
I would like to try to assign a variable value to input hidden field
i would like to know how to create a hidden type input box and
I would like to learn ASP.NET and just wanted some input as to which
I would like to know the current idle time from user input on a

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.