Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I am a helpless Python Beginner:(

How the hell do I solve this exercise, what’s the code?? I don’t understand what it wants from me and how to solve it. This is an absolute beginner exercise, so nothing very complex is expected from me here.

# Days of week are numbered as: 0 — Sunday, 1 — Monday, 2 — Tuesday, ..., 6 — Saturday. An integer K in the range 1 to 365 is given. Find the number of day of week for K-th day of year provided that in this year January 1 was Thursday.  
# Example input
#1

#Example output
#4

# Read an integer:
# a = int(input())
# Print a value:
# print(a)

I don’t know what to try really and how to start solving this exercise:(

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Here is the code:

days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
day_number = int(input("What day do you want to get: "))
day = days[day_number % 7]
print(f"Your day: {day}")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading