From 5b5bfe07ca5ecc851d1fb10abbb931012372c2d2 Mon Sep 17 00:00:00 2001 From: kjg Date: Wed, 20 May 2020 22:52:18 +0900 Subject: [PATCH] [Python #2] create e14.py --- kjg/python-the-hard-way/e14.py | 23 +++++++++++++++++++++++ kjg/python.org | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 kjg/python-the-hard-way/e14.py diff --git a/kjg/python-the-hard-way/e14.py b/kjg/python-the-hard-way/e14.py new file mode 100644 index 0000000..74bcd95 --- /dev/null +++ b/kjg/python-the-hard-way/e14.py @@ -0,0 +1,23 @@ +from sys import argv + +script, user_name, first, second = argv +prompt = '==> ' + +print(f"Hi {user_name}, I'm the {script} script.") +print("I'd like to ask you a few questions.") +print(f"Do you like me {user_name}?") +likes = input(prompt) + +print(f"Where do you live {user_name}?") +lives = input(prompt) + +print(f"What kind of computer do you have?") +computer = input(prompt) + +print(f""" +Alright, so you said {likes} about liking me. +You live in {lives}. Not suer where that is. +And you have a {computer} computer. Nice. +{first} and {second} +""") + diff --git a/kjg/python.org b/kjg/python.org index 8ef9d17..dffd17d 100644 --- a/kjg/python.org +++ b/kjg/python.org @@ -79,3 +79,5 @@ how to use key input how to use key input with print **** ex13 how to use an argument when you run script +**** ex14 +how to use an argument with input