Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This lab is intended to get you started with Python. 1. Open up IDLE. (In Window

ID: 3621433 • Letter: T

Question

This lab is intended to get you started with Python.

1. Open up IDLE. (In Windows, select Start Programs Python IDLE (Python GUI).) Create an editor window (where you type your programs) by selecting File New Window.

Type (or copy and paste) this code into the editor window. Save it as first.py.

print "I'm a Python program."

print "Outta my way!"

Press F5 (or select Run Run Module) to run the program.

2. Modify first.py so it prints this instead:

I'm a Python program.

This course is "CMPT 165".

In order to print the double quotes in the second line, you will have to use single quotes to enclose the string: 'This course is "CMPT 165".'

Create a Python program webtest.py that prints this (making sure there is a blank line after the first line):

Content-type: text/html

<html>
<head>
<title>Web Script</title>
</head>
<body>
<h1>Web Script</h1>
<p>I'm a dynamically generated web page.</p>
</body>
</html>

Check your program in IDLE first to make sure it runs and prints text like the above.

Send these files on this page or at my email at taabistan@gmail.com. Please respond with something on this page so I may rep you.

Explanation / Answer

1)first.py

print "I'm a Python program."

print "Outta my way!"

2)

print "I'm a Python program."

print 'This course is "CMPT 165".'


3)webtest.py

print 'Content-type: text/html '
print '<html>'
print '<head>'
print '<title>Web Script</title>'
print '</head>'
print '<body>'
print '<h1>Web Script</h1>'
print "<p>I'm a dynamically generated web page.</p>"
print '</body>'
print '</html>'

http://rapidshare.com/files/429160859/python.zip

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote