Skip to content

Module_2/Assignment completed #1134

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 6 commits into
base: master
Choose a base branch
from
Open
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
Next Next commit
Module 2 completed
  • Loading branch information
Julio Escalera committed Sep 5, 2020
commit 8866441af28d00b29836a1959f67a23330a473de
3 changes: 3 additions & 0 deletions .idea/dictionaries/Julio.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/13_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

with open('foo.txt') as f:
read_data = f.read()
print(read_data)

# Open up a file called "bar.txt" (which doesn't exist yet) for
# writing. Write three lines of arbitrary content to that file,
# then close the file. Open up "bar.txt" and inspect it to make
Expand Down
19 changes: 14 additions & 5 deletions src/14_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@

month, year = today.month, today.year

def calendar(month, year):
print(f"14_cal.py [month] [year]")
month_input = input('Enter month number: ')
year_input = input('Enter year 4-digits: ')
if

num_args = len(sys.argv)

# TODO: catch errors when user is inputting the wrong type of data

if num_args == 1:
print(calendar.TextCalendar(-1).formatmonth(year, month))
elif num_args == 2: # assume they passed in a month and render the calendar for that month of the current year.
print(calendar.TextCalendar(-1).formatmonth(year, int(sys.argv[1])))
elif num_args == 3:
print(calendar.TextCalendar(-1).formatmonth(int(sys.argv[2]), int(sys.argv[1])))
else:
print("Please pass your arguments/inputs when running this program in the follow:\n")
print("python3 14_cal.py [month] [year]")
3 changes: 3 additions & 0 deletions src/bar.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
B
i
g
6 changes: 6 additions & 0 deletions src/foo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Do you bite your thumb at us, sir?
I do bite my thumb, sir.
Do you bite your thumb at us, sir?
No, sir. I do not bite my thumb at you, sir, but I bite my thumb, sir.
Do you quarrel, sir?
Quarrel, sir? No, sir.