vendredi 24 avril 2015

I need to print this 20 times

So basically I have my code here which prints a random Shakespearean insult through 3 lists. To submit this code, I have to print 20 insults and I know there is a faster way than writing the final print statement 20 times. This is probably remedial but I can't remember how to do it. Here's my code thanks guys:

import random

list1 = ["Artless", "Bawdy", "Bootless", "Churlish", "Clouted"]
list2 = ["Base-court", "Bat-fowling", "Beetle-headed", "Clay-brained" ]
list3 = ["Apple-john", "Baggage", "Bladder", "Boar-pig", "Coxcomb"]

def nurd1():
  return (random.choice(list1))

def nurd2():
   return (random.choice(list2))

def nurd3(): 
    return (random.choice(list3))

print ("Thou" + " " + nurd1() + " " +  nurd2() + " " + nurd3() )




Aucun commentaire:

Enregistrer un commentaire