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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:42:42+00:00 2026-05-13T05:42:42+00:00

I am only going to post the portion where the problem is at, the

  • 0

I am only going to post the portion where the problem is at, the program has no error (all the codes are valid except for this raw_input problem)

I tested with search_function(1) and etc and it worked.

But if I do this while loop, it doesn’t print anything.
Example output:

Enter a number to print specific table,
or STOP to quit: 2 Enter a number to
print specific table, or STOP to quit:
2 Enter a number to print specific
table, or STOP to quit: 1 Enter a
number to print specific table, or STOP
to quit: Enter a number to print
specific table, or STOP to quit: 1
Enter a number to print specific table,
or STOP to quit: Enter a number to
print specific table, or STOP to quit:
STOP

def search_function(x):
    if x == 1:
        for student in students:
            print "%-17s|%-10s|%-6s|%3s" % student.print_information()
        print '\n'

    if x == 2:
        print "%-17s|%-10s|%s" %(header[0],header[1],header[4])
        print "-" * 45
        for student in students:
            print "%-17s|%-10s|%s" %student.print_first()
        print '\n'
        print "Simple Analysis on favorite sports: "
        # Printing all sports that are specified by students
        for s in set(Student.sports): # class attribute
            print s, Student.sports.count(s), round(((float(Student.sports.count(s)) / num_students) *100),1)

        # Printing sports that are not picked 
        allsports = ['Basketball','Football','Other','Baseball','Handball','Soccer','Volleyball','I do not like sport']
        for s in set(allsports) - set(Student.sports):
            print s, 0, '0%'
        choice_list = Student.sports
        for choice in choice_list:
            choice_dict[choice] = choice_dict.get(choice, 0) + 1
        print max(choice_dict)
        print min(choice_dict)

    elif x == 3:
        print "%-17|%-10s|%-16s|%s" %(header[0],header[1],header[5],header[6])
        print "-" * 45
        for student in students:
            print "%-17s|%-10s|%-16s|%s" % student.print_second()
        print '\n'

    elif x == 4:
        print "%-17s|%-10s|%s" %(header[0],header[1],header[7])
        print "-" * 45
        for student in students:
            print "%-17s|%-10s|%s" %student.print_third()
        print '\n'

    elif x == 5:
        print "%-17s|%-10s|%-15s|%s" %(header[0],header[1],header[8],header[9])
        print "-" * 45
        for student in students:
            print "%-17s|%-10s|%-16s|%s" % student.print_fourth()
        print '\n'

x = raw_input("Enter a number to print specific table, or STOP to quit: ")
while x != 'STOP':
    search_function(x)
    x = raw_input("Enter a number to print specific table, or STOP to quit: ")
  • 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-13T05:42:42+00:00Added an answer on May 13, 2026 at 5:42 am

    Test for x == 'STOP' first and break if True, else cast to int and call search_function:

    while True:
        x = raw_input("Enter a number to print specific table, or STOP to quit: ")
        if x == 'STOP':
            break
        search_function(int(x))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service implemented in WCF. This service is only going to
I've got this strange situation going on. Imagejpeg is only working when I define
Only one instance of a ScriptManager can be added to the page. this error
My Post model has the following columns: t.datetime published_at t.string status published_at Should only
This is my first post, and I've only recently started programming for Android and
I was going to post an answer on this other SO question but someone
I am getting this error with a c++ program malloc.c:4636: _int_malloc: Assertion `victim->fd_nextsize->bk_nextsize ==
Im writing a report with Reporting services that is almost always only going to
Is it okay to get a read-only collection from an aggregate without going through
I'm using the facedetect example and going from there. Right now it only detects

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.