Computers and Technology

Class Date: '''class to represent a date'''

def __init__(self, month, day, year):
'''Date(month, day, year) -> Date'''
self. month = month
self. day = day
self. year = year

def __str__(self):
'''str(Date) -> str
returns date in readable format'''
# list of strings for the months
months = ['','Jan','Feb','Mar','Apr','May',' Jun','Jul',
'Aug','Sep','Oct','Nov','Dec']
output = months[self. month] + ' ' # month
output += str(self. day) + ', ' # day
output += str(self. year)
return output

def go_to_next_day(self):
'''Date. go_to_next_day()
advances the date to the next day'''
# list with the days in the month
daysInMonth = [0,31,28,31,30,31,30,31,31,30,31,30 ,31]
# check for leap year
isLeapYear = self. year%4 == 0 and \
(self. year%100 != 0 or self. year%400 == 0)

I kinda stuck on what to write next anybody know how I can finish my go_to_next day function

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:20, milkshakegrande101
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy. a. a fire occurs on the premises, and the building isbadly damaged. b. a burglar steals some money and securities from anunlocked safe. c. a business computer is damaged by vandals whobreak into the shop after business hours. d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm. til
Answers: 2
image
Computers and Technology, 23.06.2019 09:00, vetterk1400
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
image
Computers and Technology, 23.06.2019 19:30, bevanscory123
What are loans to a company or government for a set amount of time
Answers: 1
image
Computers and Technology, 23.06.2019 21:30, quintonps12
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
Answers: 2
Do you know the correct answer?
Class Date: '''class to represent a date'''

def __init__(self, month, day, year):
...

Questions in other subjects:

Konu
Mathematics, 07.07.2021 17:50
Konu
Mathematics, 07.07.2021 17:50