Learn to Code

《笨办法学Python3》练习十一:问一些问题

2019-03-01  本文已影响0人  雨开Ame

练习代码

print("How old are you?", end = ' ')
age = input()
print("Hoe=w tall are you?", end = ' ')
height = input()
print("How much do you weigh?", end = ' ')
weight = input()

print(f"So, you're {age} old, {height} tall and {weight} heavy.")

Study Drills

  1. Go online and find out what Python’s input does.

  2. Can you find other ways to use it? Try some of the samples you find.

  3. Write another “form” like this to ask some other questions

补充

  1. 通过input()获得的是string类型的数据,如果想获得一个整数,需要用int()转换。
上一篇下一篇

猜你喜欢

热点阅读