Question

In: Computer Science

II. Big Numbers 1. Implement this program in a file named bigNums.py. 2. Create a numerical...

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.

Solutions

Expert Solution

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.


Related Solutions

Write a program named FinalExamProgram2 that reads numbers from a file (which you will create using...
Write a program named FinalExamProgram2 that reads numbers from a file (which you will create using Notepad) into a one-dimensional array and then analyzes the numbers as described below. Your program must use loops to read the numbers into the array and to analyze the contents of the array. The program’s main function should do the following:  Read eight floating-point numbers from the file named numbers.txt into a onedimensional array, displaying each number on the screen.  Pass the...
The requirements for this program are as follows: Create a header file named “Employee.h”. Inside this...
The requirements for this program are as follows: Create a header file named “Employee.h”. Inside this header file, declare an Employee class with the following features: Private members a std::string for the employee’s first name a std::string for the employee’s last name an unsigned int for the employee’s identification number a std::string for the city in which the employee works Public members A constructor that takes no arguments A constructor that takes two arguments, representing: the employee’s first name the...
Create a file named StudentArrayList.java,within the file create a class named StudentArrayList. This class is meant...
Create a file named StudentArrayList.java,within the file create a class named StudentArrayList. This class is meant to mimic the ArrayList data structure. It will hold an ordered list of items. This list should have a variable size, meaning an arbitrary number of items may be added to the list. Most importantly this class should implement the interface SimpleArrayList provided. Feel free to add as many other functions and methods as needed to your class to accomplish this task. In other...
Create a cronjob which does the following tasks 1.) create a file named <yourname>.txt 2.) in...
Create a cronjob which does the following tasks 1.) create a file named <yourname>.txt 2.) in the 35th minute of the hour change the permission to 755 3.) Create a shell script named first.sh in which you print your name and redirect the output by 45th minute of the hour to the text file
Create a program that generates a file of random numbers, and then prints them in neat...
Create a program that generates a file of random numbers, and then prints them in neat fashion to another file, and also saves to that file the average and standard deviation of those numbers. I) First, you would need to generate a file of random numbers that consists of N random numbers (100 < N < 1000). Each random digit should be a real number (type double) between 0 and 50. This file and its digits would now serve as...
WRITE A C++ PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX (Create index in text file)
WRITE A C++ PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX (Create index in text file)
WRITE A JAVA PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX (Create index in text file) full...
WRITE A JAVA PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX (Create index in text file) full code
Write a Java program named BinaryConversion that will convert base 2 numbers to base 10 numbers....
Write a Java program named BinaryConversion that will convert base 2 numbers to base 10 numbers. The data for this program will be entered from the keyboard using JOptionPane one 16-bit binary number at a time. Note that each base 2 number is actually read in as a String. The program should continue until a 16-bit base 2 number consisting of all 0’s is entered. Once the 16-bit number has been entered your program should make sure that the input...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on the command line 2. For each file name provided, delete any line that contains the string: qwe.rty When the changes are completed, the script should display the total number of files scanned, and the total number of files changed. Example Command: assessment-script-a file.a file.b file.c file.d file.e    Example Output: 5 files scanned, 3 files changed 3. Your script should include a series of...
Create a file named sales_bonus.py 2. Prompt the user for the amount of sales made, convert...
Create a file named sales_bonus.py 2. Prompt the user for the amount of sales made, convert to a float, and assign to sales. 3. Prompt the user for number of days missed, covert to an int, and assign to days_missed 4. If the user have more than 3000 of sales and has missed less than or equal to two days of work, assign bonus to 100. 5.   Else if the user have more than 3000 of sales or has missed less...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT