Question: Using python 3 List practice Create a list of numbers. For example my_list = [5, 8,100,1,5,-2] Iterate over the list, find the smallest number in

Using python 3

List practice

  1. Create a list of numbers. For example my_list = [5, 8,100,1,5,-2]
  2. Iterate over the list, find the smallest number in the list, and print it.
  1. Iterate over the list, find the largest number in the list, and print it.
  1. Iterate over the list, add all the numbers and print the sum of all numbers.
  1. Ask the user to input a number to search for in the list and count occurrences of. Iterate over the list and tell the user the index for the first occurrence of the number if the number was found in the list. Make sure this also works for the case when the number you are searching for is not in the list.
  1. Iterate over the list and tell the user the count of number of times the specified number appears in the list.

To demonstrate, generate sample output as follows:

The smallest number in [5,8,100,1,5,-2] is -2

The largest number in [5,8,100,1,5,-2] is 100

Sum of all numbers in [5,8,100,1,5,-2] is 117

Enter the number to find in the list and also count occurrences of?5

5 was found at index 0 of [5,8,100,1,5,-2]

5 occurs 2 times in [5,8,100,1,5,-2]

Note: do not use the built-in min, max, find, or sort functions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!