+1(978)310-4246 credencewriters@gmail.com
  

Description

Response 1

Denisse Barajas Lopez

Week 4 – Interactive Assignment

Describe your process in developing the program:

For this week’s interactive assignment, one uses min, max, and built-in sum functions as part of programming code (

Python Program to Find Smallest Number in a List – Geeksforgeeks

, 2018). These functions help users calculate and identify the list’s minimum value, maximum value, and sum stored in the list. Furthermore, these features streamlined one’s programming language code.

To start my programming code, one uses list variable as part of programming code:

Twenty_number_series_list = []

The user is then asked to enter a 20-number series. The append() method is used to connect each user-generated number to the twenty-number sequence list. Before appending the elements to the list, the user’s input is converted to an integer number using the following code:

for i in range (20):

Twenty_number_series_list.append(int (input ( ‘Please enter ‘ +str (i+1) +’ number of 20 number series: ‘ )))

Lastly, the data is displayed for the user, using the following code:

print( ‘The lowest number in the list:’, min (Twenty_number_series_list) )

print(‘The highest number in the list: ‘, max (Twenty_number_series_list) )

print(‘The sum of the numbers in the list: ‘, sum

output.

number_list =[]

for index in range (0, 20 , 1):

input_number = int(input(‘Enter a series of 20 numbers’))

Response 2

Cindy Mendoza

Mar 25, 2021 at 9:53 PM

The program that I developed asks a user to enter 20 numbers. The program will ask for each individual number and will give 20 input lines. I accomplished this using the range function. The inputted numbers are then stored in a list called “user_numbers”. I then had the program print out the lowest number in the list using the min function. It then prints out the highest number using the max function. I used the sum function to come up with the sum of all of the numbers in the list and then had that number printed out as well.

Copy of script:

user_numbers = []

n = 20

for i in range(0,n):

selected_num = int(input(‘Enter a number: ‘))

user_numbers.append(selected_num)

print(‘Lowest number in the list is ‘, min(user_numbers))

print(‘Highest number in the list is ‘, max(user_numbers))

summ = sum(user_numbers)

print(‘The sum of the numbers in the list is’, summ)

  
error: Content is protected !!