Answered You can hire a professional tutor to get the answer.
Python programming 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...
Python programming
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 the list, and print it.
- Iterate over the list, find the largest number in the list, and print it.
- Iterate over the list, add all the numbers and print the sum of all numbers.
- 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.
- 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]