Joey Vanorden
Joey Vanorden

Reputation: 19

convert days to weeks in python

On the first line, ask the user how many days they've been driving for and declare the user input. It's an integer, so cast the string.

Then calculate the number of years in that set of days.

Next, convert the remaining days that weren't converted to years into weeks.

Then, get any remaining days that weren't converted to weeks.

I've done everything this asks, and my classes system is telling me i'm not doing any of it even though I get the same output it is looking for

'''The program converts days you have been driving for to weeks and years'''
print("Days you have been driving: 1000")
days=1000
years=days//365
weeks=days%365//7
consDays=days%365%7
print("You have been driving for:")
print("Years:" , years)
print("Weeks:" , weeks)
print("Days:" , consDays)

i get exactly the output i need but for some reason i'm not being credited for it.

Upvotes: 0

Views: 2127

Answers (1)

Sharim09
Sharim09

Reputation: 6224

Your calculation is wrong.

days = int(input("Days you have been driving: "))
years=days//365
weeks=days//7
consDays=days%7
print("You have been driving for:")
print("Years:" , years)
print("Weeks:" , weeks)
print("Days:" , consDays)

OUTPUT (for input 1000)

You have been driving for:
Years: 2
Weeks: 142
Days: 6

Upvotes: 3

Related Questions