其他分享
首页 > 其他分享> > Exercise 14 - prompting, passing

Exercise 14 - prompting, passing

作者:互联网

 

from sys import argv

script, user_name = argv
prompt = '> '

print("Hi %s, I'm the %s script." % (user_name, script))
print("I'd like to ask you a few questions.")
print("Do you like me %s?" % user_name)
likes = input(prompt)

print("Where do you live %s?" % user_name)
lives = input(prompt)

print("What kind of computer do you have?")
computer = input(prompt)

print('''
Alright, so you said %s about liking me.
You live in %s. Not sure where that is.
And you have a %s computer. Nice.
''' % (likes, lives, computer))

output

D:\>python ex14.py Elodie
Hi Elodie, I'm the ex14.py script.
I'd like to ask you a few questions.
Do you like me Elodie?
> Yes
Where do you live Elodie?
> Auckland
What kind of computer do you have?
> Leveno

Alright, so you said Yes about liking me.
You live in Auckland. Not sure where that is.
And you have a Leveno computer. Nice.

 

2019-09-27

16:48:42

标签:Elodie,prompt,14,script,computer,print,passing,Exercise,name
来源: https://www.cnblogs.com/petitherisson/p/11597345.html