Lab 1
Interactive Python
Due within an hour after lab
Overview
You will work with the Python interpreter (IDLE) to complete some exercises. As you complete the exercise, make sure you copy and paste your work in a text editor to ensure that your work is saved. For this lab, you may discuss the questions and answers with someone else, but you must do your own typing and submission!
Interactive Python
Using the interactive Python shell, type in and evaluate Python expressions for each of the following. Use online resources if you are not sure of the needed Python operator for performing an operation.
Try out the following expressions:
- 5 + 3
- 5 * 3
- "Hello" + "!!!"
- str(100)
- "Answer: " + str(5)
- "Hello" * 5
- Try out more expressions at your own choosing
- Try out the following statements:
- print("Hey!" + " " + "There!")
- word = input("What is the password?")
- print("The word is " + word)
Explain in your own words, what happens in the last print statement.
- Question: what happens when you type the following in the
interactive shell?
"Answer: " + 5
Explain in your own words.
Python Short Program
Write and test a Python program (make sure you create and save a py file) that reads in (using the input function) a person's name (e.g. "Sally") and writes out (using the print function) a greeting to that person (e.g. "Howdy Sally").
Deliverable
Create a text file called lab1.txt that contains the following:
- A statement that summarizes your completion of the assignment. It should include any collaboration or resources that you used.
- The text of your interactive Python exercises
- Your clearly labeled answers to explanations and questions
- For your Python script:
- A listing of the script (copy the code in the py file and past it in the lab1.txt file)
- Running examples that demonstrate that your script works correctly (copy the text that shows your py file running and paste it in the lab1.txt file)
Submit your lab1.txt file to D2L.
Grading
Your lab submission will be graded using the following rubric:
- + .5 --- Your submission is clearly formatted.
- + .5 --- Your submission includes a summary statement and includes how you collaborated.
- + .5 / 1.0 --- You submitted most of the lab (0.5) or you submitted all of the lab (1.0).
- + .5 --- Your lab submission is generally correct.
Labs submitted late are subject to a half point penalty.