1.写代码获取数字1234中的十位上和百位上的数字
number = 1234
a = number // 10 % 10
b = number // 100 % 10
print(a,b)
如果变量n的值是6784,以一下表达式的结果是多少?
# n / 1000 % 100
# n % 1000 / 100
# n //100 % 10
# n // 10 % 100 //10
n = 6784
t1 = (n / 1000 % 100) = 6.784
t2 = (n % 1000 / 100) = 7.84
t3 = (n //100 % 10) = 7
t4 = (n // 10 % 100 //10) = 7
print(t1,t2,t3,t4)
3.表达式10 / 4 + 23 // 4 * 2 -30的结果是多少?
number = (10 / 4) + (23 // (4 * 2)) - 30
print(number) = -25.5
4.写出下面每一行中n3的结果
n1 = 4; n2 = 5
n3 = n1 > n2
n3 = n1 < n2
n3 = n1 == 4
n3 = n1 != 4
n3 = n1 == 1+3
print (n1 > n2) =False
print(n1 < n2) =True
print(n1 == n2) =False
print(n1 != n2) =True
print(n1 == 1+3) =True
5.写出以下代码执行完成后,num的结果
num = 10
num /= 2
num += ((10 * 10) / 4) + (2*(3**2))
print(num) = 48.0
6.下面定义变量正确的是()
A. a = b = c = 10
B. a, c = 10
C. in = 20
D. num = 10; t = 20
print("A")