Assignment 1 - Hello, Python!
Due: Friday, January 5, 2024, at 4pm
You may work alone or with a partner, but you must type up your code yourself. You may also discuss the assignment at a high level with other students. You should list any student with whom you discussed the assignment, and the manner of discussion (high-level, partner, etc.) in top-level comments within your source code file.
You should submit your assignment as a .py
file on Moodle at this link.
Goals
The primary goal for this assignment is to get you up and running with Python. You will need to make sure you can write and execute Python programs to complete this assignment and test it; the actual code you write will be quite simple.
Part 0: Comments and collaboration
# You should be equipped to complete this part after Lesson 1 (Wednesday Jan. 3).
For each assignment in this course, you are expected to provide top-level comments (lines that start with #
at the top of the file) on any .py
source code files with your name and a collaboration statement. For this assignment, your program should be named intro.py
.
Here is an example of how you can start your file:
# File: intro.py
# Author: Sadie Amert
# Purpose: Assignment #1 - Hello, Python!
#
# Collaboration statement:
# - Lulu: partner (worked on code together)
# - Hobbes: discussed issues with spaces in print() output
# - Slack: link to Python documentation for print()
Part 1: Hello, user!
# You should be equipped to complete this part after Lesson 1 (Wednesday Jan. 3).
For this part, you should write a program that asks the user for their first and last name, and then greets them by name. Your program should also ask their age and give them an estimate on the number of days old they are (assuming exactly 365 days per year). This code should live in the intro.py
file you started in Part 0.
Here is an example interaction that your program should be able to mimic:
Hello there!
What is your first name? Sadie
What is your last name? Amert
How old are you, in years? 15
Have a great day, Sadie Amert!
You are approximately 5475 days old.
Part 2: Reflection
# You should be equipped to complete this part after Lesson 1 (Wednesday Jan. 3).
Were there any particular issues or challenges you dealt with in completing this assignment? Write a brief discussion (a sentence or two is fine) at the bottom of your intro.py
file (in comments, so each line should start with #
).
Here are some examples:
##### Reflection #####
# I had trouble getting the spaces right in the output.
# I had to look up how to use print() in the Python documentation.
##### Reflection #####
# I started late, so I had to rush to make sure I knew how to use VS Code.
# It may be good to start early next time.
##### Reflection #####
# It went fine; I found what I needed in my notes.
Grading
This assignment will be graded out of 100 points, as follows:
- 10 points - submit a valid
.py
file with the right name (intro.py
) - 10 points -
intro.py
file contains top-level comments with author name, collaboration statement - 30 points - prompt for user first and last name, then print message with them
- 30 points - prompt for user age in years, then print message with age in days
- 10 points - match example interaction exactly (e.g., punctuation, spaces, etc.)
- 10 points - reflection in comments at the bottom of the
intro.py
file
What you should submit
You should submit a single intro.py file on Moodle at this link.