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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:56:42+00:00 2026-06-14T02:56:42+00:00

Sometimes when I run this in IDLE, the shell will only show >> However,

  • 0

Sometimes when I run this in IDLE, the shell will only show

 >>

However, when I close the window and kill the program, it’ll appear as normal for a split second before closing. Most of the time it will work though.

  • 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-14T02:56:43+00:00Added an answer on June 14, 2026 at 2:56 am

    For your problem in IDLE, I’d try flushing the stdout regularly to see if it helps at all.

    Some comments about your code follow:

    • About the use of global variables, for most cases, you can simply substitute their use by function arguments. When you (think you) need to modify a global variable, generally you’re choosing the wrong functions to write. As an example, there’s absolutely no need to set the guesses variable inside generate(), you can just do it in play().

    • instead of allowed = ('0','1','2','3','4','5','6','7','8','9','0','+','*'),
      consider import string ; allowed= list(string.digits+'+'+'*'). Do a dir(string) in the interpreter for more useful variables there.

    • there’s no need to evaluate equality of a boolean. while (numguesses < maxguesses) and flag==True: should be while (numguesses < maxguesses) and flag:

    • play_again() is unnecessarily recursive.

    • s1 = secret[0] ; s2 = secret[1] could be s1,s2=secret[:2]

    • for i in range(max): ; num = num + str(randint(0,9)) could be rewritten as "".join([str(randint(0,9)) for i in range(max)]). Some people will argue the first is more readable, it’s up for you to decide.

    Finally this:

    if (i%2 == 0): 
        evaluated = evaluated + s1
    else:
        evaluated = evaluated + s2
    

    could be replaced simply by evaluated= (evaluated+s1) if not(i%2) else (evaluated + s2).
    I think you don’t actually need the parenthesis, but they add readability, IMHO

    Obviously there’s a lot more that could be said about the general structure of the code, I tried to focus on python language features you may not know at this point

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

Sidebar

Related Questions

When i run this program, it appears that sometimes 55 will be printed out,
I am trying to run a program and SOMETIMES I'm getting this error when
When I run this, it will SOMETIMES print out a null termination character. Most
Has anyone ever run into this issue before? Sometimes the string displays, sometimes half
IDLE is being very dodgy as to when it will actually show an Auto-complete
I have a program which during it's run sometimes needs to call python in
When I run my website,sometimes run without error and some times this exception accord.
Sometimes when i run this code I get a process and id and sometimes
Below is my code. When I run this code it always gets stuck. Sometimes
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

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.