python - Writing a random-generating quiz, need to recall the object that was randomly generated -


I am very new to Python, so I'm sure my code is very ineffective, etc., but I'm just currently By doing this, I want to feel and learn my way, so please forgive my general ignorance.

In my quiz, there is currently a series of quotes and randomly prints the first 20 letters (through pieces) of them, the idea that the quiz reads the rest

I would like to add the ability to get the full quote, but I do not know how the python was created random module to remember the dragon.

Code:

  Import control random = true JCIIiii34 = "Brave men do not taste death but once" SonnetSeventin = "If I see the beauty of your eyes I can write, \ nAnd all your Graces in the latest numbers, \ n this poet of the coming age lied, \ n such a long touch touches ne'er worldly face. SonnetEighteen = "So long as Men can see breath and eyes, it can live for a long time, and you can JCIii101 = "As I did, as I left myself for the" printed "quote type after 'exit', or 'next' for the next quote" During the control: Print quote [: 20] var = raw_input ("\ n") if var == "exit": control = false elif var == (like "Sonnet Erie Een", "JCIIII, JCIII"), "quote = random" "Next": print "\ n" control = true   

so what do I want to be able to do Another elif statement is saying

  elif var == "answer": printed # full quote   

where the print statement is basically a cut object , But prints it in full.

I have read the Python library entry and did not get any answers for the random module.

I also open this for a more efficient way of doing this (I know that I can store excerpts in a separate file, but it is not understood yet).

Thanks for any help in advance!

You can use your quote : < Pre = control: quote = random.choice ([SonnetSenvittin, Sonnet erie een, jciiii 34, jcii101]) Print quote [: 20] var = raw_input ("\ n") if var == "exit": Control = wrong alive var == "next": print "\ n" control = true elif var == "answer": print quote

Comments