I'd just like to know how you would insert input that is stored in a variable into a while loop. Also I'd like to know what Boolean expression is best to use.
2 Replies - 206 Views - Last Post: 10 December 2012 - 03:48 PM
#1
Inserting input stored in a variable into a while loop.
Posted 10 December 2012 - 03:06 PM
Replies To: Inserting input stored in a variable into a while loop.
#2
Re: Inserting input stored in a variable into a while loop.
Posted 10 December 2012 - 03:21 PM
I dont understand what you are trying to accomplish.
My best guess is:
My best guess is:
value = "string" while(True): print(value)
#3
Re: Inserting input stored in a variable into a while loop.
Posted 10 December 2012 - 03:48 PM
The question is a bit difficult to understand. I guess you still try to solve your old problem of reading a non determined number of inputs until "END" appears as input.
I hate to comply to "give me the codes" kind of questions. But for something that basic I cannot help it. Any explanation would be confusing. So once in a while:
I hate to comply to "give me the codes" kind of questions. But for something that basic I cannot help it. Any explanation would be confusing. So once in a while:
keep_asking_for_input = True
input_list = []
while keep_asking_for_input == True:
s = input("blahblah")
if s == "END": #or whatever is the codeword for ending input
keep_asking_for_input = False
else:
input_list.append(s)
#now do something with the input_list data
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|