4000 《笨办法学python》加分习题13——我的答案
2017-08-14 10:39
295 查看
这是我自己学习的答案,会尽力写的比较好。还望大家能够提出我的不足和错误,谢谢!
这边我在使用pychram运行的时候出现了错误,错误如图:
上网查证,以及根据作者意思使用shell框执行可以出答案,答案如图:
就是说要有三个以上的值传入。
2、ex13_1.py:
运行结果:
ex13_2.py:
运行结果:
3、ex13_4.py:
运行结果:
文中例子:
from sys import argv script, firsrt, secend, third = argv print "The script is called:", script print "Your first variable is:", firsrt print "Your second variable is:", secend print "Your third variable is:", third
这边我在使用pychram运行的时候出现了错误,错误如图:
上网查证,以及根据作者意思使用shell框执行可以出答案,答案如图:
习题答案:
1、如同上文中的使用pychram一样,当时并没有给出运行参数,使用shell框运行截图:就是说要有三个以上的值传入。
2、ex13_1.py:
from sys import argv script, name, age = argv print "The script is called:", script print "Your name is:", name print "Your age is:", age
运行结果:
ex13_2.py:
from sys import argv script, name, age, height, weight = argv print "Your name is:", name print "Your age is:", age print "Your height is:", height print "Your weight is:", weight
运行结果:
3、ex13_4.py:
from sys import argv script, name, age = argv print "The script is called:", script print "Your name is:", name print "Your age is:", age
print "Your height is:",
height = raw_input()
print "Your weight is:",
weight = raw_input()
运行结果:
相关文章推荐
- 《笨办法学python》加分习题29——我的答案
- 《笨办法学python》加分习题32——我的答案
- 《笨办法学python》加分习题37——我的答案
- 《笨办法学python》加分习题12——我的答案
- 《笨办法学python》加分习题16——我的答案
- 《笨办法学python》加分习题1——我的答案
- 《笨办法学python》加分习题33——我的答案
- 《笨办法学python》加分习题4——我的答案
- 《笨办法学python》加分习题6——我的答案
- 《笨办法学python》加分习题7——我的答案
- 《笨办法学python》加分习题18——我的答案
- 《笨办法学python》加分习题19——我的答案
- 《笨办法学python》加分习题5——我的答案
- 《笨办法学python》加分习题20——我的答案
- 《笨办法学python》加分习题2——我的答案
- 《笨办法学python》加分习题8——我的答案
- 《笨办法学python》加分习题35——我的答案
- 《笨办法学python》加分习题36——我的答案
- 《笨办法学python》加分习题40——我的答案
- 《笨办法学python》加分习题42——我的答案