Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am new at Python and I could use some help. Specs For this assignment, you will create a script in the Python language. You

I am new at Python and I could use some help.

Specs

For this assignment, you will create a script in the Python language. You can read more about Python here:

http://www.python.org/ (Links to an external site.)Links to an external site.

All execution, compiling, and testing of this script should ONLY be done in the bash prompt on our class server!

Your script must satisfy the following requirements:

Be contained in one single file, called mypython.py.

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 should be a newline character.

When executed, print out on screen the contents of the 3 files it is creating in exactly the format given below.

When executed, after the file contents of all three files have been printed, print out two random integers (whose range is from 1 to 42, inclusive), and print out the product of the two numbers, again in exactly the format given below.

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.

Note that the visual format for all of this is completely up to you! The graders will simply be checking for the above requirements to assign your grade. 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 

Example Output

Here's an example of the script being run; all output is random except for the last line.

$ python mypython.py vwdzwuxwvh nibqaackrp pxeugdqnwc 8 10 80 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions