提示和传递练习****
from sys import argv
script, user_name = argv
prompt = ‘>’
print(f’Hi {users_name}. I am 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(‘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 sure where that is.
And you have a {computer} computer. Nice.
“”")
终端
“C:\Program Files\Python37\python.exe” C:/Users/星溯/Desktop/新代码小课/ex14.py
Traceback (most recent call last):
File “C:/Users/星溯/Desktop/新代码小课/ex14.py”, line 3, in
script, user_name = argv
ValueError: not enough values to unpack (expected 2, got 1)
进程已结束,退出代码1