[Solved] SOLVED:Laboratory 1 – Getting Started with Python; Simple Arithmetic

30 $

File Name: SOLVED:Laboratory_1_–_Getting_Started_with_Python;_Simple_Arithmetic.zip
File Size: 659.4 KB

SKU: [Solved] SOLVED:Laboratory 1 – Getting Started with Python; Simple Arithmetic Category: Tag:

Or Upload Your Assignment Here:


Computer Science 222

LearningObjectives:

1. Understand the editing and execution phases of a computerprogram.

2. Be able to execute a Python program using the IDLE integrateddevelopment environment (IDE).

3. Interact with simple Python programs that produce output and doarithmetic.

4. Enter new programs using the IDLE editor.

DirectedActivities:

1. Log on to the computerusing your Cougars account information.

a. Create a foldernamed “Lab01” on the Desktop.

2. Open your WebCT accountfor this course (e.g CSCI 222-L01).

You can get toWebCT from the CofC webpage. Open a web browser and go to www.cofc.edu.

a. On the Homepage, select Labs, and select the one entitled Lab01 (clickon the title Lab01).

b. Under Assignment files, in the Files box, you will see two files.Click on “First.py”.

c. In the View Files window, you’ll see the file name again. Clickon the circle in front of it and then press the Download button.

d. When asked, choose to “Save” the file and store it onthe Lab01 folder on your Desktop of your computer. This will place the file onyour computer’s desktop. You should see the file named “First.py”.(Today we’ll work on the Desktop – starting soon, you will have your own diskspace available on these lab computers.)

3. Open and execute yourfirst Python program using IDLE.

a. Open the IDLE integrated development environment (IDE) bydouble-clicking on the icon labeled IDLE.

b. On the IDLE toolbar, choose File,then Open, and navigate to theDesktop. Select the file named “First.py” (it may or may not showan extension of “py”) on the Desktop.

c. Double click (left mouse button) on the “First.py”file and an editing window will open and display the code in that program. Thetop of the edit window displays the name of the program (“First.py”.)

d. Replace the text <yourname goes here with your name.

e. To execute the program, from the Run menu select Run module. Or simply press the F5 key.This opens the Python Shell window that displays the output of the program –the message “Programming is fun but is not a spectator sport!” (aword to the wise).

f. Go back to the editor window. Change the message (stuff inquotes) so that the program prints out “I look forward to learning tocontrol this computer through programming!” Save by pressing Control-S.Execute your program, following instructions from part (e).

Demonstrate forinstructor.

You’ll be asked to upload this program toWebCT later, so don’t change it any more.

4. Enter a new programusing the editor.

(Python iscase-sensitive, so type caps when you see caps and lower-case letters when yousee lower-case letters.)

a. From the File menu, select NewWindow. Type in the following exactly as you see it there, except replace goes here with your name.

## SimpleAddition.py

## here

def main():

num1 = 7

num2 = 5

answer = num1 + num2

print “Sum =”, answer

main()

b. Once you have typed the complete program, press “Control-S”and save the program as SimpleArithmetic.py. Run itby pressing F5. If you see an error message, you typed something incorrectly.Compare the printout above with your program and fix any discrepancies found.If you cannot find the error, ask the instructor for assistance. (Computers arevery picky about how programmers express things, and do not tolerate typos.)Continue this process until the program runs successfully.

Congratulations!You’ve successfully entered and executed your first complete Python program.

Demonstrate forinstructor.

5.Writing your own programs.

Write a programsimilar to the one above that subtracts two numbers and prints thedifference. Call this program SimpleDifference.py.

Demonstrate forinstructor.

6.Writing your own program.

Write a programto calculate the volume of a rectangular solid.The user of the program will provide the length, width and height of thebox. Call this program BoxArea.py.

Demonstrate forinstructor.

7. Upload the files toWebCT under the Assignments section:

Check list:

First.py_______ SimpleAddition.py_______

SimpleDifference.py _______ BoxArea.py _______

You must pressthe SUBMIT button or the uploadedprograms will not be submitted to the professor’s account.

Remove from thedesktop any files and folders you created (that should include the First.py thatyou downloaded – mail them to yourself if you wish to have a copy.) Then, emptyyour recycle bin. Log out of your Cougars account.

7.Log off of the computer you are using.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Laboratory 1 – Getting Started with Python; Simple Arithmetic
30 $