I'm a newbie. I want to learn how to write in Python.

I read Somerfield, read 60 pages and approached the first examples and exercises, and realized that I couldn’t normally solve more than one program for reading these 60 pages.

Even this one! Explain how to write it correctly?

It is necessary to generate the text from the lists

Closed due to the fact that the essence of the question is incomprehensible by the participants: Vladimir Martyanov , Kromster , Dmitriy Simushev , pavel , HamSter Oct 8 '16 at 4:52 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • four
    The question should be more specific so that something sensible will be answered; and in such a statement he only provokes aggression ... - Artyom Ionash
  • I think it is worthwhile to read everything again from the very beginning, only thoughtfully and with understanding - Alex Chermenin
  • @DukeSpontaneous, well, actually, this question should provoke a more or less constructive discussion of literature for learning ... (but, not on this site) - avp
  • Python, I remember threw after the first ten pages. to java , so its syntax seemed too unreadable - Flippy
  • Even this task is too unsuccessful. feed unsuccessful. And so ... read the first time you need the first time skipping obscure places and understanding clear ones - so you format and prepare your brain. In the second pass, even the basic code of the syntax of the language, that is, the simplest instructions, will be executed — you will forget without doing it. The brain remembers only what it uses. - vitidev

1 answer 1

The task is really unsuccessful, as in my opinion. And its submission only confuses. "do 5 cycles" - why 5 ??? unclear. For quatrain, 4 is required. In general, 1 cycle and 4 iterations. In general, they want something like this from you.

 import random articles = ['the', 'a'] nouns = ['cat', 'dog', 'man', 'woman'] verbs = ['sang', 'ran', 'jumped'] adverbs = ['loudly', 'queitly', 'well', 'badly'] for _ in range(4): article = random.choice(articles) noun = random.choice(nouns) verb = random.choice(verbs) adverb = random.choice(adverbs) sentype = random.randint(0, 1) if sentype == 0: sentense = "{} {} {} {}".format(article, noun, verb, adverb) else: sentense = "{} {} {}".format(article, noun, verb ) print(sentense)