Code doesn't wait for raw_input before exiting

A forum for general discussion of the Python programming language.

Code doesn't wait for raw_input before exiting

Postby ravada » Wed Jul 03, 2013 9:35 am

Hi ,

I am a beginner coding in python. I have problem with running the python script.
When ever i import the module "random " and try to run the program it doesn't wait for the user to exit the program inspite of raw_input command.
I tried to debug and the out put looks fine in IDLE(GUI).
Not sure what is going wrong. Can some one help?
Here is the program am trying to run

Code: Select all
import random
while count < 100:
    count += 1
    if flip == 1:
        heads += 1
    if flip == 2:
        tails += 1
print "no of heads:"
print heads
raw_input("press any key to exit")

it works fine in GUI. But doesn't run when i directly try to run the code (by double clicking)
Any help will be appreciated
Last edited by Yoriz on Fri Jul 05, 2013 8:54 pm, edited 1 time in total.
Reason: Added code tags
Posts: 1
Joined: Wed Jul 03, 2013 9:24 am

Re: Code doesn't wait for raw_input before exiting

Postby Yoriz » Fri Jul 05, 2013 8:56 pm

It works fine for me, does anything at all happen when you double click the py file?
Due to the reasons discussed here we will be moving to on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Return to General Discussions

Who is online

Users browsing this forum: Bing [Bot] and 2 guests