Question

use python to write You want to figure out how many days you spent in your...

use python to write

You want to figure out how many days you spent in your highschool education. Assign the start and the end year for your highschool studies (or you can make up two years that are at least 2-4 years apart). For simplicity, we will not worry about the months or the actual dates. Write a program that will display how many days you had in that range (inclusive of both the years). For example, if you started your undergrad in 2015 and finished in 2016, you will have 731 days.

[ Hint: you will need to write a loop that runs with that range. Within that loop, you will need to check for leap year. Remember -- our program needs to be general, and so while we have a specific application in mind, the loop we write should be able to work on any two years, no matter how far apart.]

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program Code Screenshot :

- total days.py - D:/Coding/Python/total days.py (3.7.4) File Edit Format Run Options Window Help #Initialize start and finis

Sample Output :

RESTART: D: /Coding/Python/total days.py 731 Total days >>> |

Program Code to Copy

#Initialize start and finish years
start = 2015
finish = 2016

total = 0
for i in range(start,finish+1):
#Add days
total += 365
#Add 1 more day, if leap year
if i%400==0 or (i%4==0 and i%100!=0):
total+=1
print('Total days ',total)

Add a comment
Know the answer?
Add Answer to:
use python to write You want to figure out how many days you spent in your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3. Using no date-specific Java libraries, write a program that computes the number of days between...

    3. Using no date-specific Java libraries, write a program that computes the number of days between any two dates (inclusive). You must take into account leap years. The rule for computing a leap year is as follows: If the year is divisible by 4 it is a Leap Year ... Unless the year is divisible by 100, then it is _not_ a Leap Year ... Unless the year is divisible by 400, then it _is_ a Leap Year. During a...

  • Write a program to find number of days in a month: Header comments must be present...

    Write a program to find number of days in a month: Header comments must be present Prototypes must be present Use comments and good style practices NOTE: For simplicity, we will ignore leap years (i.e. February will always have 28 days). main() function: Display hello message Call getMonth and assign result to month Call getDaysInMonth and assign result to days Display results Display goodbye message getMonth() function: Prompt user for month Loop until month is between 1 and 12 Return...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

  • Please write a Java program that ask the user how many beers he or she expects...

    Please write a Java program that ask the user how many beers he or she expects to consume each day, on average, as well as the average amount of money he or she spends on a single 12-ounce can of beer. Studies have shown that, on average, someone who consumes a single 12-ounce can of beer every day without compensating for the calorie intake through diet modifications or extra exercise, will gain approximately 15 pounds in one year. You can...

  • Write a C# program that prints a calendar for a given year. Call this program calendar....

    Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:             0 Sunday                     1 Monday                   2 Tuesday                   3 Wednesday       4 Thursday                 5 Friday                      6 Saturday Your program should...

  • Write a C# program that prints a calendar for a given year. Call this program calendar....

    Write a C# program that prints a calendar for a given year. Call this program calendar. This program needs to use Switch Case in order to call the methods and format to print each month. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:      ...

  • JAVA Program! Write a program that makes use of threading. You will have one thread count how many times a second has p...

    JAVA Program! Write a program that makes use of threading. You will have one thread count how many times a second has passed and the second thread will count how many times 3 seconds has passed This will occur in an infinite loop and the counts will be printed to the screen. Indent the count of one of the threads for easier viewing Write a program that makes use of threading. You will have one thread count how many times...

  • Write a program and flowchart. The program should ask the user how many customers they want to track. Then, it asks for customer numbers, and sales by customer. At the end, it prints out the customer...

    Write a program and flowchart. The program should ask the user how many customers they want to track. Then, it asks for customer numbers, and sales by customer. At the end, it prints out the customer number, the customer sales, and then the total sales and average sales. You must use two different arrays, one for customer number, and one for sales. These are, in effect, parallel arrays.   You must use a "while" loop to gather customer number and sales....

  • PYTHON I need some basic python homework help! Write a program that prompts the user to...

    PYTHON I need some basic python homework help! Write a program that prompts the user to enter a date (day, month, and year). Your program will print out the day of the week for that date. You do not need to validate the input. That means you can assume: the year will be entered as a four-digit number in the range 1900 through 2100 inclusive. the month will be one of the strings "January", "February", . . ., "December". the...

  • Write a program using M.I.P.S that asks user “how many positive number that is devisable by...

    Write a program using M.I.P.S that asks user “how many positive number that is devisable by 6 you want to add?” .Then your loopcounter would be the user input. If the user enters a positive number between 1 and 100 that is devisable by 6, you increment your loop counter and add it to the sum.. You need to decide if the positive number entered by the user is divisible by 6 or not. Your program should print an error...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT