WhatsApp Number: +1(249) 265-0080
Python Programming Help
Q1. Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list then display the following data:
- The lowest number in the list
- The highest number in the list
- The total of the numbers in the list
- The average of the numbers in the list
Q2. Total Sales – Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in a list. Use a loop to calculate the total sales for the week and display the result.
Python Programming Help Explanation
- The program asks the user to input 20 numbers using a
for
loop and stores them in a list. - It calculates:
- The lowest number using
min()
. - The highest number using
max()
. - The total of all numbers using
sum()
. - The average by dividing the total by the number of elements.
- The lowest number using
- Finally, it displays the results.
numbers = [] # Step 2: Ask the user to enter 20 numbers for i in range(20): num = float(input(f”Enter number {i+1}: “)) numbers.append(num) # Step 3: Calculate the required values lowest_number = min(numbers) highest_number = max(numbers) total = sum(numbers) average = total / len(numbers) # Step 4: Display the results print(“\n— Results —“) print(f”Lowest number: {lowest_number}“) print(f”Highest number: {highest_number}“) print(f”Total of numbers: {total}“) print(f”Average of numbers: {average}“) ….
Python Programming Help Explanation
- The program asks the user to input 20 numbers using a
for
loop and stores them in a list. - It calculates:
- The lowest number using
min()
. - The highest number using
max()
. - The total of all numbers using
sum()
. - The average by dividing the total by the number of elements.
- The lowest number using
- Finally, it displays the results.
numbers = [] # Step 2: Ask the user to enter 20 numbers for i in range(20): num = float(input(f”Enter number {i+1}: “)) numbers.append(num) # Step 3: Calculate the required values lowest_number = min(numbers) highest_number = max(numbers) total = sum(numbers) average = total / len(numbers) # Step 4: Display the results print(“\n— Results —“) print(f”Lowest number: {lowest_number}“) print(f”Highest number: {highest_number}“) print(f”Total of numbers: {total}“) print(f”Average of numbers: {average}“) ….
Make your order Now at academicartisanwritinghub.com