Skip to content
Advertisement

Tag: while-loop

Loop through variable in python

Please forgive me… new to python and first question on stack. I’m trying to accomplish two things with while loop: increment round number (i’m doing this successfully) have the loop iterate over my variable “fruits” to print the first fruit on round one and second fruit on round two variables: round_number = 0 fruit = [apple, orange, banana] python code:

Separating two print() outputs under a while loop [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 months ago. Improve this question Question: Enter a value for n, and the code takes n floating numbers and prints out the first highest and second-highest numbers. Sample Output 1:

Why am I getting Syntaxerror for this while loop? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 10 months ago. Improve this question

How to Repeat an Iteration in a For loop, Python 3

I am currently working on implementing the numerical method RKF45 (Runge-Kutta-Fehlberg-45) with adaptive step size into python 3 and I believe I am running into a fundamental loop issue that I cannot resolve. Note, the portion of this numerical method I am having trouble implementing is the adaptive step size. I understand the basic algorithm for how this may be

How can I end the while loop in my code below? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 11 months ago. Improve this question

Using a while loop to output a list after user input

I’m new to python and im attempting for my program to output a the variable “movie genre” vertically once a user enters their name. I plan to use a while loop but keep hitting the error “movie_genre”. And perplexed as to how to proceed. Answer You didn’t show error message but if this is your original indentations then problem is

Python for loop to while loop for unique value

This program makes it so if a repeat letter is used twice in a string, it’ll appear only once in the list. In this case, the string “Hello, world!” will appear as [‘H’, ‘e’, ‘l’, ‘o’, ‘w’, ‘r’, ‘d’] My question is, how would I go about using a while loop instead of a for loop to achieve the same

How to keep running a nested While in python

I have a pygame. in it there are a few nested while loops, running all of them one time accomplish one round, how do I keep rounds going and going, never stop? Repeat{I have a pygame. in it there are a few nested while loops, running all of them one time accomplish one round, how do I keep rounds going

Advertisement