Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your script must satisfy the following requirements: 1. Be contained in one single file, called mypython.py. 2. When executed, create 3 files in the same

image text in transcribed

Your script must satisfy the following requirements: 1. Be contained in one single file, called "mypython.py". 2. When executed, create 3 files in the same directory as your script, each named differently (the name of the files is up to you), which remain there after your script finishes executing. Each of these 3 files must contain exactly 10 random characters from the lowercase alphabet, with no spaces ("hoehdgwkdq", for example). The final (eleventh) character of each file MUST be a newline character. Additional runs of the script should not append to the files. Thus, running wc (wordcount) against your files in the following manner must return 11: $ cat myfile gkwjhcfikf $ WC -c myfile 11 myfile 3. When executed, output sent to stdout should first print out the contents of the 3 files it is creating in exactly the format given below. 4. After the file contents of all three files have been printed, print out two random integers each on a separate line (whose range is from 1 to 42, inclusive). 5. Finally, on the last (sixth) line, print out the product of the two numbers. You do not have to parse and read the data back in from the files created in step 2 in order to complete step 3. For step 3, just dump the contents that you already randomly generated in your program directly onto the screen, if that's the easiest way for you. I recommend that you look into sys.stdout.write() for outputting text, as it will allow you to control newlines better. The graders will simply be checking for the above requirements to assign your grade, using the exact format shown below. Further, no help on this assignment will be provided by the Instructor or TAs at any time. You can choose to use Python 2 or Python 3. The TAs will try all three of these commands to find one that works with your script: $ python mypython.py $ python2.7 mypython.py $ python3 mypython.py Python is NOT a topic that will be covered on the Final. Example Output Here's an example of the script being run. All output is random except for the last line (since it's the product of the 4th and 5th lines), and your output must match the format shown here: $ python mypython.py vwdzwuxwvh nibqaackrp pxeugdanwc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

Students also viewed these Databases questions