CLA Project 7, A and B – You will create two programs on Ranger

CLA Project 7, A and B – You will create two programs on Ranger first using IDLE. Then you will create a
script log for each one. And then finally, copy the code of each program into MyProgrammingLab for
grading!
Part A
1.
2.
3.
4.
5.
Log into Ranger
At the ranger$ prompt – type in idle3 &
In the idle shell window click on File to New File
This new window is the idle scripting window, this is where we will type the program.
Type in the following comments at the top of the program:
# Your Name
# csci 1170 – 00x
# CLAProject7A
# Writing golf data out to a file
6. Now save this file to your CLA directory and call it project7A.py
7. Create a program that solves the description below. Run your program several times as you
work so that you will discover any syntax errors right away. The output must match the sample
exactly.
Program Description:
The Springfork Amateur Golf Club has a tournament every weekend. The club president has asked
you to write a program that will read each player's name and score as keyboard input, and then
save these as records in a file named golf.txt.
First, have the program ask the user how many players they want to add to their record. Then, ask
the user for each name and score individually.
golf.txt should be structured so that there is a line with the player's name, followed by their score
on the next line. For example, the golf.txt output file might look like this:
Emily
30
Mike
20
Jonathan
23
A sample Run:
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output)
>python3 GolfScoreWriter.py
Enter number of players: 4
Enter name of player number 1:
Enter score of player number 1:
Enter name of player number 2:
Enter score of player number 2:
Enter name of player number 3:
Enter score of player number 3:
Enter name of player number 4:
Enter score of player number 4:
Jimmy
30
Carly
20
Marissa
55
Brett
23
8. Once your program is finished, we will create a script file for grading purposes. Go to the
ranger$ prompt and do each of these commands one at a time. You may need to make sure you
are in the CLA directory first (cd CLA). You need to be in the same directory as the project7A.py
file. Type in ls for list to know where the file is. Be sure the correct information does display on
the screen (we need to be able to see your program code and your program run and also the
contents of the file that was created by your program)
script claProject7A.log
cat –n project7A.py
python3 project7A.py
(Enter any 3 player names and scores)
cat golf.txt
exit
9. Now print your script log file by typing: lph claProject7A.log
10. Turn in your printout to your GTA
11. Assuming MyProgrammingLab is working, let’s copy your code into the solution area and click
submit to have your program graded instantly!
a. Log into MyProgrammingLab
b. LOAD our Python course
c. Locate and expand the Chapter 6 questions
d. At the bottom of the chapter list expand the Programming Projects
e. Click to select Question # 71434
f. Scroll down in the Workbench Work Area, copy your program from the IDLE scripting
window to the MPL Work Area.
g. Now click SUBMIT, Did it grade correctly?, If not, let us help you fix it!
Part B
1. Log into Ranger
2. At the Ranger $ prompt – type in cd CLA
3. At the Ranger $ prompt - run the following command to copy a sample golf.txt file to your
directory:
wget https://cs.mtsu.edu/~rbucher/1170/golf.txt
4.
5.
6.
7.
At the ranger$ prompt – type in idle3 &
In the idle shell window click on File to New File
This new window is the idle scripting window, this is where we will type the program.
Type in the following comments at the top of the program:
# Your Name
# csci 1170 – 00x
# CLAProject7B
# Reading data from the golf.txt file
8. Now save this file to your CLA directory and call it project7B.py
9. Create a program that solves the description below. Run your program several times as you
work so that you will discover any syntax errors right away. The output must match the sample
exactly.
Program Description:
Write a program that reads the records from the sample golf.txt file (that was downloaded in step
3) and prints them in the following format:
Name: Emily
Score: 30
Name: Mike
Score: 20
Name: Jonathan
Score: 23
10. Once your program is finished, we will create a script file for grading purposes. Go to the
ranger$ prompt and do each of these commands one at a time. You may need to make sure you
are in the CLA directory first (cd CLA). You need to be in the same directory as the project7B.py
file. Type in ls for list to know where the file is. Be sure the correct information does display on
the screen (we need to be able to see your code and that you ran the program two times!)
script claProject7B.log
cat –n project7B.py
python3 project7B.py
exit
11. Now print your script log file by typing: lph claProject7B.log
12. Turn in your printout to your GTA
13. Assuming MyProgrammingLab is working, let’s copy your code into the solution area and click
submit to have your program graded instantly!
a. Log into MyProgrammingLab
b. LOAD our Python course
c. Locate and expand the Chapter 6 questions
d. At the bottom of the chapter list expand the Programming Projects
e. Click to select Question # 71435
f. Scroll down in the Workbench Work Area, copy your program from the IDLE scripting
window to the Work Area.
g. Now click SUBMIT, Did it grade correctly?, If not, let us help you fix it!