Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. #name1 = name of first person
  2. #name2 = name of second person
  3. #yon = yes or no
  4. #Printname function = asks name and prints greeting
  5.  
  6.  
  7. def Printname():
  8.     name1 = raw_input ("What is your name?")
  9.     name2 = raw_input ("What is your friend's name?")
  10.     print "Hello!", name1
  11.     print "Hello!", name2
  12.     Rep()
  13. def Rep():
  14.     rep = raw_input ("Would you like to do it again? Y or N")
  15.     if rep == "Y":
  16.             Printname()
  17.     elif rep =="N":
  18.         Nothx()
  19.     else:
  20.         Error()
  21.         Rep()
  22. def Nothx():
  23.     print "Okay, Goodbye!"
  24. def Error():    
  25.     print "You have pressed an incorrect key."
  26. yon = raw_input ("Would you and your friend like a greeting? Y or N")
  27. if yon == "Y":
  28.     Printname()
  29. elif yon =="N":
  30.     Nothx()
  31. else:
  32.     print "You have entered an incorrect key"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement