Ana sayfa
/
Teknoloji
/
Part 1 (30pts): Define a Python function called getQulizes() that takes an integer N as parameter. This function will prompt the user to Input N quiz scores and add them to a list and return the list when done. Write Python statements that input the number of quizzes, call this function and print the returned list as seen in sample run below. Part 1: piên so onter 3 so thế scoro of quike 20 Plas so ntar the score quiz-2: 90 Plea so entor score quiz-3. 85 Your s cores are stored in the following list: [20,90,85]

Soru

Part 1 (30pts):
Define a Python function called getQulizes() that takes an integer N as parameter. This function will
prompt the user to Input N quiz scores and add them to a list and return the list when done.
Write Python statements that input the number of quizzes, call this function and print the returned list
as seen in sample run below.
Part 1:
piên so onter	3
so	thế scoro of quike 20
Plas so ntar the score quiz-2: 90
Plea so entor	score quiz-3. 85
Your s cores are stored in the following list: [20,90,85]

Part 1 (30pts): Define a Python function called getQulizes() that takes an integer N as parameter. This function will prompt the user to Input N quiz scores and add them to a list and return the list when done. Write Python statements that input the number of quizzes, call this function and print the returned list as seen in sample run below. Part 1: piên so onter 3 so thế scoro of quike 20 Plas so ntar the score quiz-2: 90 Plea so entor score quiz-3. 85 Your s cores are stored in the following list: [20,90,85]

Çözüm

4.5286 Voting
avatar
Ceyda
Kıdemli · 12 yıl öğretmeni
Uzman doğrulaması

Cevap

Here is the Python function `getQuizzes()` that takes an integer `N` as a parameter, prompts the user to input `N` quiz scores, adds them to a list, and list when done:<br />```python<br />def getQuizzes(N):<br /> quizzes = []<br /> for i in range(N):<br /> score = int(input(f"Please enter the score for quiz {i+1}: "))<br /> quizzes.append(score)<br /> return quizzes<br />```<br />To input the number of quizzes, call this function, and print the returned list, you can use the following Python statements:<br />```python<br />N = int(input("Enter the number of quizzesquizzes = getQuizzes(N)<br />print("Your scores are stored in the following list:", quizzes)<br />```<br />Sample run:<br />```python<br />Enter the number of quizzes: 3<br />Please enter the score for quiz 1: 20<br />Please enter the score for quiz 2: 90<br />Please enter the score for quiz 3: 85<br />Your scores are stored in the following list: [20, 90, 85]<br />```
Derecelendirmek için tıklayın: