0
One of the questions of a college task is giving work to the whole class, so far no one has been able to answer question 4. A friend of mine tried with this code, but it doesn’t work right, because depending on the entries, the month comes out 13, 14, 19 and countless other non-existent months. Could someone give me a hand? PS: Needs to be in python 3.
Question: You will have a wonderful holiday that starts on Wednesday 3rd. You will return from your holiday after 137 nights (Wow!). Write a program that asks for the day of the month and the day of the week that you will travel and ask for the number of days that you will be on vacation and print the day of the week that you will return.
Code:
def questao4(m,s,f):
f = f+m
t = f%30
rs = t%7
return print("Mês =", t,"Dia da semana =", rs)
questao4(9,3,1)
I understand that the question is about calculus, probably to teach something, but I must say that considering possibly time zones, variations of days for each month and something more perhaps, I humbly suppose that it will not be accurate to do only on the basis of the calculation, would have to use some lib that works with dates and Timezone.
– Guilherme Nascimento
Assuming I was doing based on the Timezone of Brazil, I would be able to give some hint of how to do this?
– John HW
Timezone Brazil or does not vary as or may vary, see even the president could have taken the summer time of SP, but did not, maintained, which would already affect the application, a lib so will work based on the time of the machine and the machine (be it Windows, or Linux) lower the updated time and thus you would achieve "accuracy" (approximately, with loss of seconds maybe, or if the user changes something on the machine, as the time). What I mean is that if the task of the college is intended to teach mathematics + programming to lib and time zones will not solve anything, because ...
– Guilherme Nascimento
... the focus of the task question is to learn mathematics with python, now if that is not the goal of your teacher then yes a Python LIB that works with Timezone and etc would be the ideal way, I can only give you "tips" or even make a suggestion if you are sure that your teacher has explained the intention of this.
– Guilherme Nascimento
The teacher does not prioritize that we learn mathematics, but rather that we are able to encode what is requested.
– John HW
I understand John, but many exercises may have some basis to be applied so anyway I hope that then the use of libs
date
andtimedelta
work it out for you.– Guilherme Nascimento
So just to finish, I I suppose that informing the day of the week in the question is a huge indication that the problem is of mathematics, because if it is not then inform the day of the week would be irrelevant in a use with date libs/Apis, just the month and day of it that the rest of the to solve in the "API" same.
– Guilherme Nascimento
The "worst" is that it’s not really about focusing on mathematics, it’s about solving what is asked doesn’t matter whether you use math at all, or just thinking. I appreciate the help x)
– John HW