1
vote
7answers
79 views

How do I return the product of a while loop

I don't get the concept of loops yet. I got the following code: x=0 while x < n: x = x+1 print x which prints 1,2,3,4,5.That's fine, but how do I access the computation done in the loop. ...
1
vote
1answer
46 views

Python - if statement inside while loop not responding

I'm having trouble with an if statement inside a while loop. while pressed == 8 : print(answerlistx[randomimage], answerlisty[randomimage]) entryx = e1.get() entryy = e2.get() answerx ...
2
votes
2answers
42 views

Passing values through while loop error

I'm having trouble passing values through my while loop. Ive coded below with some pseudocode in Place still I'm unsure how to achieve the result but I have attached my code below to help if it can. ...
0
votes
1answer
68 views

Python - while loop hanging without errors

I'm trying to create a while loop which will check the entry widgets e1 and e2 for the correct answer from a list and if it is correct it will randomly choose another image to place onto the canvas ...
0
votes
3answers
56 views

for or while loop to do something n times

In Python you have two fine ways to repeat some action more than once. One of them is while loop and the other - for loop. So let's have a look on two simple pieces of code: for i in range(n): ...
1
vote
1answer
48 views

Complete a task during certain time frames within a python script

As you can see below here is a copy of my script what I've created, could someone help me improve/fix my currenttime tasks. Basically, during the day periodically calls test every 3 mins +- 60 ...
1
vote
2answers
84 views

While loop issue - Python

I've created a simple text-based game in Python which I'm using in conjunction with libPd (wrapper for Pure Data). All the game code was written before the audio was implemented and works as intended; ...
1
vote
2answers
43 views

Simple Python Webbrowser Loop

I am trying to have this program open a tab, wait for 15 seconds, then quit Chrome and reopen the tab immediately. Right now, it opens a tab, waits for 15 seconds then closes Chrome and waits for ...
2
votes
1answer
44 views

Need help printing multiple rows in loop

I have a print statement, print '0.860\t', model[i+26][16],'\t', 0.1*(float(model[i+26][16])),'\t','35\t I (assume 10% error)' Briefly, my data file is multiple rows, this specific print command ...
2
votes
1answer
36 views

Tkinter - button command and gui blocks

I'm trying to begin using tkinter for designing some graphical interface, but I actually have a problem... Here is my little code: #!/usr/bin/python3 # -*- coding: utf-8 -*- # imports from ...
2
votes
1answer
53 views

Python: Conditional OR

I have the following while loop: accuracy = 0.0001 # Or whatever loop_limit = True limit = 100 # Main loop: while abs(P - P_old).max() > accuracy or (if loop_limit: count > limit): ...
1
vote
3answers
89 views

While loop termination in Python

I have the code below, and for some reason the while loop is not terminating. def iterator(i, f): print len(f) print i while i < len(f): if i == 0: print ...
2
votes
2answers
44 views

How to use raw_input() with while-loop

Just trying to write a program that will take the users input and add it to the list 'numbers': print "Going to test my knowledge here" print "Enter a number between 1 and 20:" i = ...
1
vote
3answers
316 views

Proper Exiting of While Loop on Error

I'm curious what is the 'proper' pythonic way of handling this error with a while loop. I could simply check the string to see if it has a [-1] character beforehand in this example, but the actual ...
5
votes
3answers
81 views

Python: Why does this code execute?

I'm a beginner in python and using v2.7.2 here's what i tried to execute in the command prompt p = 2 while(p>0): for i in range(10): print i+1 , p p-=1 The expected ...

1 2 3 4 5 25
15 30 50 per page