0

When i have my script that generate random words repeat itself it stops genrating more random words, how do i fix this

i have this at the end that repeats the process: running=True while running == True: print(word) if input("Again? (yes/no) ") != "yes": running=False

7th Mar 2017, 4:32 PM
Matthew Williams
Matthew Williams - avatar
2 odpowiedzi
+ 7
I saw your code. My suggestion: def word (): word1 = random.randint(1,16) word2 = random.randint(1,16) word3 = random.randint(1,16) word = word1a[word1] + " " + word2a[word2] + " " + word3a[word3] + " are now your Words!" return word run = True while run: print(word()) cont = input("continue? [yes/no]") if cont != yes: run = False tell me if it works
8th Mar 2017, 2:11 AM
LayB
LayB - avatar
0
First off, that is not a generator, as it doesn't have a yield statement. Second, I don't know what you expect your code to behave like and what it does, so you won't have my help until you fix that
7th Mar 2017, 8:41 PM
Amaras A
Amaras A - avatar