Question: In python programming 3.6.3 While loop You have a variable x assigned the value of 1. Write an infinite loop that will keep replacing the
In python programming 3.6.3
While loop
You have a variable x assigned the value of 1. Write an infinite loop that will keep replacing the value in x with x+1.
Write the same loop but this time it will only increment x until the value is greater than 10.
Here is another infinite loop:
while True:
print("This will run forever")
In the example above we just hard-coded the word True (with a capital T). In Python that's the same as if we had a Boolean expression such as 1==1.
Write a while True loop the will ask the user to input a letter. This will run forever unless the user enters a "q". After the input line, test the user's answer with an if-statement to see if they entered a "q". If they do, you put one line, break, tabbed in on the next line after the if-statement. That will get you out of the while-loop.
Do the same thing as above, but this time ask the user for a number each time (remember user input starts as text - you must change this). If the number is less than 5 break.
This command will let you find out how long a word or list is:
len(somelist)
len(someword)
Write a while-loop that will ask the user for a word. If the word is longer than 7 characters, break out of the loop.
Same thing, but this time if the word is shorter than 3 characters break out of the loop.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
