×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create a Program to Calculate Score Average in Python Assignment Solution

July 15, 2024
Prof. James Harper
Prof. James
🇦🇪 United Arab Emirates
Python
Prof. James Harper is an experienced software developer and educator with a Master's degree in Computer Science from the University of Melbourne. With over 900 completed assignments, he specializes in Python programming and application development. Prof. Harper's passion for teaching and extensive industry experience ensure that his solutions are not only functional but also well-documented and easy to understand.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Use well-structured shaders to optimize rendering and ensure efficient resource management. Start with simple shapes, gradually adding complexity, and debug in small steps to identify errors easily.
News
An open-source framework that allows developers to create rich Python applications in the browser using HTML's interface, bridging the gap between web development and Python scripting.

Instructions

Objective

Write a program to calculate score average in python.

Requirements and Specifications

Write a python homework that calculates the average of the scores in a list. The program should print the list before calculating the average and after it is calculated.

Hints:

Create a list with numbers

Print the list

Calculate the total of the list elements using a for loop

Calculate the average of the elements (use len function) and display the avg

Write a program that demonstrates the insert method. The program should print the list before and after the insert.

Hints:

Create a list with 6 names

Print the list

Call the insert function to insert another name in ‘5’ element of the list and then print the list.

Write a program that asks the User to enter a series of 5 numbers. The program should store the numbers in the list and then display the Lowest and Highest number in the list.

Hints:

Create an empty list

Define variables

Prompt the user for numbers and use a for loop store the numbers in the list (use append method).

Use min and max function to calculate Low and high numbers

OUTPUT should look like :

program to calculate score average in python

Source Code

Q1

# Create a list with numbers scores = [72, 41, 58, 60, 97, 65, 59, 57, 10, 56] # Print the list print("Scores = " + str(scores)) # Calculate the total total = 0 for score in scores: total += score # Calculate the average average = total / len(scores) # Display average print("Average = " + str(average))

Q2

# Create a list with 6 names names = ['Alice', 'Bob', 'Charlie', 'Dan', 'Esther', 'Fred'] # Print the list print("Names = " + str(names)) # Insert another an element on the 5th elements names.insert(4, 'Susan') # Print the list print("Names = " + str(names))

Q3

# Create an empty list numbers = [] # Input 5 numbers for i in range(5): numbers.append(float(input("Enter number " + str(i + 1) + " of 5: "))) # Get the min and max values in the numbers print("Low: " + str(min(numbers))) print("High: " + str(max(numbers)))

Related Samples

Check out our free Python assignment samples for a clear perspective on various programming challenges. These samples provide detailed solutions and practical examples, demonstrating the application of Python in different scenarios. Whether you're tackling basic or advanced topics, our samples offer valuable insights to guide your studies and improve your approach to Python assignments.