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

  • SEARCH
  • Home
  • 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 6023101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:57:19+00:00 2026-05-23T03:57:19+00:00

I am starting to learn python. I have gone through several tutorials and now

  • 0

I am starting to learn python. I have gone through several tutorials and now I am trying to write my first script. It is a simple console menu. I am running Python 2.6.5 under cygwin.

Here is my script:

import sys

print "********************************************************************"
print "**  1) This is menu choice #1                                     **"
print "**                                                                **"
print "**                                                                **"
print "**                                                                **"
print "**                                                                **"
print "**                                                                **"
print "********************************************************************"
print
print "Choice ?"

choice = sys.stdin.readline()

print "You entered: " + choice

if choice == 1:
    choice1 = sys.stdin.readline()
    print "You entered:" + choice1
else:
    quit()

print "Exiting"

When I run the script, I get to the Choice? prompt. I enter 1 and I get the “You entered:” message and then the script exits without displaying the “Exiting” message.

Seems like it should be so easy. Thanks in advance for any help.

  • 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-05-23T03:57:19+00:00Added an answer on May 23, 2026 at 3:57 am

    You’re comparing a string to an integer. Try converting the string into an integer:

    if int(choice.strip()) == 1:
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first question here. I am trying to learn python by stepping through project euler,
I'm starting to learn Python and I've come across generator functions, those that have
A friend was burned when starting to learn Python, and now sees the language
I am just starting to learn Python, but I have already run into some
I'm just starting to learn Python and have heard about the GIL and how
I'm new to Python and starting to learn it. However I have one query,
I'm a C++ programmer just starting to learn Python. I'd like to know how
I am just starting to learn javascript, so I don't have the skills to
im just starting to learn flex and im trying to understand how Flex does
I'm starting to learn Excel Programming and have been doing the development in Excel

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.