学 Python,告别“不浪漫罪名”!女朋友想要星星,小明就给她星星,女朋友收到后非常满意。下列哪项是小明写的正确的代码()。
A: number = int(input("How many stars do you want?"))for i in range(1, number):print('*', end=' ')
B: number = int(input("How many stars do you want?"))for i in range(number):print('*', end=' ')
C: number = int(input("How many stars do you want?"))for i in range(number):print('*', end=' ')
D: number = int(input("How many stars do you want?"))for i in range(1, number):print('*', end=' ')
A: number = int(input("How many stars do you want?"))for i in range(1, number):print('*', end=' ')
B: number = int(input("How many stars do you want?"))for i in range(number):print('*', end=' ')
C: number = int(input("How many stars do you want?"))for i in range(number):print('*', end=' ')
D: number = int(input("How many stars do you want?"))for i in range(1, number):print('*', end=' ')
举一反三
- 学Python,告别“不浪漫罪名”!女朋友想要星星,小明就给她星星,女朋友收到后非常满意。下列哪项是小明写的正确的代码( ) A: number = int(input('How many starts do you want?')) for i in range(1, number): print('*', end=' ') B: number = int(input('How many starts do you want?')) for i in range(number): print('*', end=' ') C: number = int(input('How many starts do you want?')) for i in number: print('*', end=' ') D: number = int(input('How many starts do you want?')) for i in range(0, number-1): print('*', end=' ')
- 下列语句的输出结果是: number = 4 while number >; 0: for i in range(number): print(i, end='') number -= 1 A: 0123012010 B: 012301201 C: 01230120 D: 0123012
- How many ( ) of luggage do you have? A: pieces B: number
- 假设 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
- 下列程序段执行后,输出结果是: number = 20 try: if number < 0: number = -number print(number,end=) except: print("有异常发生",end=) else: print("平安无事",end=) finally: print("我很好我可以的",end=)