• 2022-06-15
    下列语句的输出结果是: number = 4 while number >; 0: for i in range(number): print(i, end='') number -= 1
    A: 0123012010
    B: 012301201
    C: 01230120
    D: 0123012
  • A

    举一反三

    内容

    • 0

      以下程序的输出结果是___________。 number = 10 if number % 2 == 0: print(number, 'is even') elif number % 5 == 0: print(number, 'is multiple of 2')

    • 1

      假设 number 的输入是9。以下程序将显示什么?‌number = eval(input("Enter an integer: ")) isPrime = True for i in range(2, number): if number % i == 0: isPrime = False print("i is", i) if isPrime: print(number, "is prime") break else: print(number, "is not prime")‌​‌ A: i is 3 9 is prime B: i is 3 9 is not prime C: i is 2 9 is prime D: i is 2 9 is not prime

    • 2

      中国大学MOOC: 以下程序的输出结果是?number = 30if number % 2 == 0: print(number, is even)elif number % 3 == 0: print(number, is multiple of 3)

    • 3

      以下代码的输出结果是_________? int number = 6; while (number >; 0) { number -= 3; System.out.print(number + " "); } A: 60 B: 63 C: 30 D: 3 0 -3

    • 4

      以下代码的运行结果为 def calculate(number): result = 0 i = 1 while i <= number: result = result + i i += 1 return result result = calculate(100) print('1~100的累积和为:', result)