In: Computer Science
II. Big Numbers 1. Implement this program in a file named bigNums.py. 2. Create a numerical (integer) list, named numbers. Populate the list with 1,000,000 (one million) integer values with values from 0 to 999,999. Hint: Use the range() function. 3. Print the length of the list to the screen. Ensure you have 1,000,000 items in your list. Hint: Use the len() function. 4. Print the smallest item value in the list to the screen. Hint: use the min() function. Example: print('List min value is: ' + str(min(numbers))) 5. Print the largest item value in the list to the screen. Hint: use the max() function. Example: print('List max value is: ' + str(max(numbers))) 6. Print the sum of all the item values to the screen. Hint: use the sum() function. Example: print('List sum is: ' + str(sum(numbers))) 7. Create a slice of the list starting at item index 100. 8. Make the slice 25 items in length. 9. Copy the slice to be a new list named new_numbers. 10. Print the new list to the screen.
numbers = [] size = 1000000 numbers = [i for i in range(size)] print(len(numbers)) print('List min value is: ' + str(min(numbers))) print('List max value is: ' + str(max(numbers))) print('List sum is: ' + str(sum(numbers))) slicedList = numbers[100:][:25] new_numbers = slicedList.copy() print(new_numbers)
************************************************** Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.
Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.