以下程序关于全局变量a的使用不正确的是()
A: a=8 deff(): print(a) f() print(a)
B: a=8 deff(): print(a) a=a*10 print(a) f() print(a)
C: a=8 deff(): globala a=40 print(a) a=a*10 print(a) f() print(a)
D: a=8 deff(): a=40 print(a) a=a*10 print(a) f() print(a)
A: a=8 deff(): print(a) f() print(a)
B: a=8 deff(): print(a) a=a*10 print(a) f() print(a)
C: a=8 deff(): globala a=40 print(a) a=a*10 print(a) f() print(a)
D: a=8 deff(): a=40 print(a) a=a*10 print(a) f() print(a)
举一反三
- 【单选题】以下程序关于全局变量a的使用不正确的是() A. a=8 def f(): print(a) f() print(a) B. a=8 def f(): print(a) a=a*10 print(a) f() print(a) C. a=8 def f(): global a a=40 print(a) a=a*10 print(a) f() print(a) D. a=8 def f( 答
- 阅读下面的python程序,请问输出结果是什么? Print(“T”,end=’’) if not 0 else print (‘F’,end=’’) Print(“T”,end=’’)if 6 else print (‘F’,end=’’) Print(“T”,end=’’)if””else print(‘F‘,end=’’) Print(“T”,end=’’)if”abc”else print(‘F’,end=’’) Print(“T”,end=’’)if____else print (‘F’,end=’’) Print(“T”,end=’’)if(1,2)else print(‘F’,end=’’) Print(“T”,end=’’)if[ ]else print(‘F’,end=’’) Print(“T”,end=’’)if[1,2]else print(‘F’,end=’’) Print(“T”,end=’’)if{ }else print(‘F’,end=’’) Print(“T”,end=’’)if{1,2}else print(‘F’,end=’’)
- 下列程序段的执行结果为。 x=40 SelectCasex CaseIs>=10 Print"A" CaseIs>=20 Print"B" CaseIs>=30 Print"C" CaseIs>=40 Print"D" EndSelect
- 以下程序段输出结果是() int a=45,b=40,c=50,d; d=a>30?b:c; switch(d) { case 30 : print f("%d",a); case 40 : print f("%d",b); case 50 : print f("%d",c); default : print f("#");} A: 40 B: 45 C: 4050 D: E: 50 F:
- 下列程序输出为False的是 A: import randoma=[1,2,3]b=random.choice(a)print(b in a) B: import randoma=random.uniform(1, 3)print(a < 1) C: import randoma=random.getrandbits(3)print(a < 8) D: import randoma=random.randrange(10, 100, 10)print(a % 10 == 0)