Edit typos and grammar and add python files
This commit is contained in:
parent
c1222a8103
commit
991caf0521
16 changed files with 285 additions and 3 deletions
32
thinkcspy/Chapter-2-Exercises/Python-Files/problem4.py
Normal file
32
thinkcspy/Chapter-2-Exercises/Python-Files/problem4.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#5Runestone.Academy thinkcspy course
|
||||
# Chapter 2
|
||||
# Problem 4
|
||||
|
||||
currentDay = input('''Enter the current day using one of the following numbers:
|
||||
Sunday = 0
|
||||
Monday = 1
|
||||
Tuesday = 2
|
||||
Wednesday = 3
|
||||
Thursday = 4
|
||||
Friday = 5
|
||||
Saturday = 6''')
|
||||
currentDay = int(currentDay)
|
||||
|
||||
stayLength = input('How long is your stay?')
|
||||
stayLength = int(stayLength)
|
||||
|
||||
# Improved upon the long windedness of my answer this time by following the example of the solution
|
||||
# in the previous problem
|
||||
stay = currentDay + stayLength
|
||||
returnDay = stay % 7
|
||||
|
||||
print('It is currently Day', currentDay,'.')
|
||||
print('Your stay is ', stayLength, 'days long.')
|
||||
print('You will return on Day', returnDay, '.')
|
||||
print('''Sunday = 0
|
||||
Monday = 1
|
||||
Tuesday = 2
|
||||
Wednesday = 3
|
||||
Thursday = 4
|
||||
Friday = 5
|
||||
Saturday = 6''')
|
||||
Loading…
Reference in a new issue