__________     __ __     __  _______    ________
  / ____/ __ \   / // /    / / / /  _/ |  / / ____/
 / / __/ / / /  / // /_   / /_/ // / | | / / __/
/ /_/ / /_/ /  /__  __/  / __  // /  | |/ / /___
\____/\____/     /_/    /_/ /_/___/  |___/_____/

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

python daily question每日一题 (#2)

BY: @cynthialee | CREATED: March 7, 2018, 5:38 p.m. | VOTES: 3 | PAYOUT: $0.00 | [ VOTE ]

"python mytest.py v1 v2 "命令运行mytest.py脚本,通过"from sys import argv"如何得到v2的参数值?
A. argv[0]
B. argv[1]
C. argv[2]
D. argv[3]

Using 'python mytest.py v1 v2' command to run the script, how can we get the value of parameter v2 via 'from sys import argv' ?

A. argv[0]
B. argv[1]
C. argv[2]
D. argv[3]

(#1)答案

B,因为赋值语句并不会有返回值,因此y=z+1这个表达式没有返回值,因此不能赋值给x,因此是非法的。实际运行结果见下图
[IMAGE: https://steemitimages.com/DQmSSAedm3ZjsJbucuEdodmkoGNc6Be2jn5XjGHCJX87NWb/image.png]
红色箭头表示该语句是非法的语句。

B, as the assignment statements don't have return values, the y=z+1 don't return anything. Thus this can't be assigned to value x and the statement is invalid. The result shown in the picture above.

TAGS: [ #cn ] [ #python ] [ #programming ] [ #daily-improvement ]

Replies

NO REPLIES FOUND.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>