import random a = "the", "at", "to", "of" n = "cat", "dog", "girl", "boy" v = "sang", "ran", "jumped", "danced" ad = "loudly", "quietly", "well", "badly" for a1, n1, v1, ad1 in range(x): a1 = random.choice(a) n1 = random.choice(n) v1 = random.choice(v) ad1 = random.choice(ad) print (a1, n1, v1, ad1) How then to make five cycles and using the function random.choice() to select the article, noun, verb and adverb?
I have only the first line. I can not figure out how to repeat five times.
random.choice(). If you can’t fix it yourself, then ask a separate question (specifically about the TypeError you are getting. The body of the cycle (afterrange(x):can simply be replaced with apassin this case - this does not affect the occurrence of the error) - jfs