Skip to content

Basics #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Basics #1143

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Modified store
  • Loading branch information
clbmiami2004 committed Sep 10, 2020
commit d92772f85a6d5806f64f5c0d623795b44788d9ee
13 changes: 7 additions & 6 deletions src/14_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,19 @@
month = datetime.now().month
year = datetime.now().year
# Render the cal for that
cal = calendar.TextCalendar()
cal.prmonth(year, month)

# User passed in one argument:
elif num_args == 2:
# Assume the arg is the specified month
# Render the cal for that month of the current year
year = datetime.now().year
month = int(sys.argv[1]) #index 0 is always the name of the program. NOt what we want right now.
cal = calendar.TextCalendar()
cal.prmonth(year, month)

# User passed in 2 arguments
elif num_args == 3:
# Render the cal for the specified month and specified year.
month = int(sys.argv[1])
year = int(sys.argv[2])
cal = calendar.TextCalendar()
cal.prmonth(year, month)

# User passed in some other number of arguments:
else:
Expand All @@ -82,3 +76,10 @@

# exit the program
sys.exit(1) # 1 means that something incorrect happened in the program.

cal = calendar.TextCalendar()
cal.prmonth(year, month)

# In order to try this we I have to enter this: /usr/local/bin/python3 "/Users/christianlorenzo/Library/Mobile Documents/com~apple~CloudDocs/Python Development/Intro-Python-I/src/14_cal.py"
# And then leave a space and then enter the number for the month that I'm interested in printing out, or the number for the month and the year

4 changes: 2 additions & 2 deletions src/Store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Store:
def _init_(self, name, departments):
def __init__(self, name, departments):
self.name = name
self.departments = departments

Expand Down Expand Up @@ -42,4 +42,4 @@ def __str__(self):

chosen_department = store.departments[int(selection) - 1]

print("You picked the {chosen_department.name} department.")
print("You picked the {chosen_department.name} department.\n")