How many times does the following Python program print the word "morning"? i=1 While i >=1: print ("good") i=i+1 print("
Posted: Thu Jul 14, 2022 2:17 pm
How many times does the following Python program print the word "morning"? i=1 While i >=1: print ("good") i=i+1 print("morning") 0 1 10 infinite
Sachin Choudhary: Attempt 1 def printList(theList): while (i<3) : print (thelist) i=i+1 What is the printout of the following Python program? def printList(theList): i=θ while (i<3) : print ( thelist) i=i+1 Ist =[1,5,−4,25,3θ,θ,100] printList (1st) It prints the first three numbers in the list. It prints the first four numbers in the list. It generates an error. It nrinte all the numbersinthe list AA Q d2l.langara.bc.ca C
Question 31 (2 points) ✓ Saved The following Python program is supposed to calculate and display the area of a circle for positive values of radius. Which of the following statements is correct? radius = float(input("Enter the radius: " )) if radius >θ: area =3+14∗ (radius * 2 ) else: print ("Enter a positive value for radius") print ("area =∗, area) The program generates an error if radius is negative. The program generates an error if radius is positive. The program always runs correctly. AA d2l.langara.bc.ca C
The following Python program is supposed to calculate the sum of two input numbers: num1 = input("Enter a number: ") num2 = input("Enter a number: ") sum = num 1+ num 2 Which of the following statements is correct about this code? The program always runs correctly. The program generates an error only if num 1 and num 2 are strings. The program has a logic error. The program generates a syntax error.
Sachin Choudhary: Attempt 1 def printList(theList): while (i<3) : print (thelist) i=i+1 What is the printout of the following Python program? def printList(theList): i=θ while (i<3) : print ( thelist) i=i+1 Ist =[1,5,−4,25,3θ,θ,100] printList (1st) It prints the first three numbers in the list. It prints the first four numbers in the list. It generates an error. It nrinte all the numbersinthe list AA Q d2l.langara.bc.ca C
Question 31 (2 points) ✓ Saved The following Python program is supposed to calculate and display the area of a circle for positive values of radius. Which of the following statements is correct? radius = float(input("Enter the radius: " )) if radius >θ: area =3+14∗ (radius * 2 ) else: print ("Enter a positive value for radius") print ("area =∗, area) The program generates an error if radius is negative. The program generates an error if radius is positive. The program always runs correctly. AA d2l.langara.bc.ca C
The following Python program is supposed to calculate the sum of two input numbers: num1 = input("Enter a number: ") num2 = input("Enter a number: ") sum = num 1+ num 2 Which of the following statements is correct about this code? The program always runs correctly. The program generates an error only if num 1 and num 2 are strings. The program has a logic error. The program generates a syntax error.