pleabargain

learn python3 the hard way lesson 14a

May 3rd, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. #http://learnpythonthehardway.org/book/ex14.html
  2. #Add another argument and use it in your script.
  3. #to run C:\Python33>python PTHW14a.py Henry 14
  4. from sys import argv
  5.  
  6. script, user_name, age = argv
  7. prompt = '>'
  8.  
  9. print ("Hi {}, I'm the {} script".format(user_name, script))
  10. print ("{} you are {} years old. Good to know".format(user_name,age))
  11. print ("I'd like to ask you a few questions.")
  12. like = (input("Do you like me {}?".format(user_name)))
  13.  
  14. lives = (input("Where do you live {}?".format(user_name)))
  15.  
  16. computer = (input("What kind of computer do you have {}?".format(user_name)))
  17.  
  18. print ("""
  19. Alright, so you said {} about liking me.
  20. You live in {}. I'm not sure where that is.
  21. And you have a {} computer. Cool. Not bad for someone who is {}.
  22. """.format(like,lives,computer,age))
Add Comment
Please, Sign In to add comment