1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ostrovityanka [42]
3 years ago
7

Assignment 8: Calendar Create a calendar program that allows the user to enter a day, month and year in three separate variables

. Then ask the user to select froma menu of choices using this formatting: Please enter a date Day: Month: Year: Menu: 1) Calculate the number of days in the given month. 2) Calculate the number of days left in the given year t must include the following functions: ter and returns a 1 if a year is a leap year et and O if it is not. This information will only be used by other functions umber of days: This subprogram will accept the date as parameters and return how many days are in the given monthe. the date as parameters and then calculate the number of days left in the year. This should not include the date the user entered in the count
this is what I have so far:
def number_of_days(m):
if (m == 1,3,5,7,8,9,11):
woh = 31
elif (m == 2):
woh = 28
elif (m == 4,6,10,12):
woh = 30
print (woh)
print (29)


def days_left(d,m,y):
if (d > 0):
print ('135')
def leap_year(d,m,y):
if (d > 0):
print ('1')

day = int(input('Enter the day.'))
month = int(input('Enter the month.'))
year = int(input('Enter the year.'))
menu = int(input('Day in month or left in year? (1,2)'))
if (menu == 1):
monthdays = number_of_days(month)
print (monthdays)
elif (menu == 2):
dayleft = days_left(day,month,year)
print (dayleft)
Computers and Technology
1 answer:
Katen [24]3 years ago
5 0

Answer:

Following are the correct code to this question:

def leap_year(year):#defining a method to check if year is leap year

   if ((year%4==0) and (year%100!=0)) or (year%400==0):#defining condition to check value

       return 1 #return value 1

   return 0 #return 0

def number_of_days(month,year):#defining method number_of_days to calculate year or month is leap year are not  

   if month==2: #defining if block to calculate leap year value  

       if leap_year(year):#using if block to call leap_year month  

           return 29#return value 29

   return 28 #return value 28

   if month in days_31: #defining if block to calculate day

       return 31 #return value 31

   return 30#return value 30

def days_left(day,month,year):#defining method days_Left  

   daysLeft = number_of_days(month,year)-day#defining variable daysLeft which calls number_of_days method  

   month += 1 #increment month variable value by 1

   while month<=12:#defining while loop to Calculate left days

       daysLeft += number_of_days(month,year) #using daysLeft variable to hold number_of_days value

       month += 1 #increment value of month variable by 1

   return daysLeft #return daysLeft value

days_31 = [1,3,5,7,8,10,12] #defining days_31 dictionary and assign value

days_30 = [4,6,9,11] # defining days_30 dictionary and assign value

print('Please enter a date') #print message

day = int(input('Day: ')) #defining day variable and input value  

month = int(input('Month: '))#defining Month variable and input value

year = int(input('Year: '))#defining Year variable and input value

print('Menu:')#print message

print('press 1 to Calculate the number of days in the given month.')#print message

print('press 2 to Calculate the number of days left in the given year.')#print message

choice = int(input())#defining choice variable and input the value

if choice==1: #defining if block to check choice

   print(number_of_days(month,year)) #call method number_of_days and print value

elif choice==2: #defining elif block to check value

   print(days_left(day,month,year))#call days_left and print value

Output:

Please enter a date

Day: 2

Month: 6

Year: 2018

Menu:

press 1 to Calculate the number of days in the given month.

press 2 to Calculate the number of days left in the given year.

2

194

Explanation:

In the given python code, three methods "leap_year, number_of_days, and days_left " is declared, in which we calculate all the values that can be described as follows:

  • In the leap_year method, it accepts the year variable, which calculates the year is the leap year and returns its value that is 1.
  • In the next method number_of_days, it is declared that accepts the "year and month"  variable as the parameter and calculates and returns its value.
  • In the last days_left method, it calculates the left days and returns its value, and outside the method, two dictionary variable days_31 and days_30 is declared, which assign a value and used use three input variable day, month, and year variable to accepts user input value.
  • In the next step, a choice variable is declared, that input values and calls and print its value accordingly.
You might be interested in
A call center company wants to implement a domain policy primarily for its shift workers. The call center has large groups with
spayn [35]

In my opinion, the best solution for the call center company to implement is to enforce time of day restrictions.

D) Time-of-day restrictions.

<u>Explanation:</u>

As the employees of the call-center company work in shifts, it would be the best solution to incorporate time of day restrictions. Each employee has already been allotted a shift, so every employee should only be allowed to log in when their shift is active.

Reduced failed logon attempts, mandatory password changes, and increased account-lockout time are also good practices to incorporate but the performance of the shift will be best monitored when the time of day restrictions are made.

In this way, the company will know who all from the employees are allowed to log in and it will subsequently decrease the traffic as well.

7 0
3 years ago
Which is not covered under the Computer Access Device and Computer Fraud and Abuse Act (CADCFA)? unauthorized use of federal com
Mazyrski [523]

Answer:

The correct answer to the following question is "Typewriters".

Explanation:

CADCFA seems to be the very first provision of federal laws to specifically concentrate on computer assault. These clauses continued to allow corporations to prosecute unjust workers for compensation for the misuse of confidential or sensitive information.

  • Even though we all agree that sometimes a federal worker uses the typewriters in the abundance of power, that's why it's not protected by that same act.
  • The other options are incorrect because they are all known and are covered for that given CADCFA act.
5 0
3 years ago
You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
shtirl [24]

Answer:

a)

Explanation:

Since the worksheet contains most of the data that you need, there is a decent possibility that it also contains the data that you are missing. Therefore, you should check for data you have previously hidden. Sometimes, some data in a worksheet may become irrelevant in a given moment, and instead of deleting it since it may be useful later most people tend to make that data hidden. So checking for previously hidden data may be the best solution in this scenario.

7 0
3 years ago
The four functions of a computer are
ehidna [41]
The four basic functions of a computer are input, processing, output and storage.
6 0
3 years ago
What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
Monica [59]

Answer:

1b. Accessibility  1c. Efficiency  1d. Relevance

2. $10 billion

3. False

4. All of them

5. Drone Delivery

Explanation:

1. Information technology is the study or use of systems (especially computers and telecommunications) for storing, retrieving, and sending information and it must be accurate, accessible, efficient and relevant.

2. Every year about $10 billion is spent on SCM (supply chain management software).

3. supply chain is the network of all the individuals, organizations, resources, activities and technology involved in the creation and sale of a product, from the delivery of source materials from the supplier to the manufacturer, through to its eventual delivery to the end user while software are just virtual tools use in the day to day activities.

4. Every activity mention is creating a new demand for the radio-frequency identification technology.

5. Drone delivery

7 0
3 years ago
Other questions:
  • Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw(
    14·1 answer
  • Which button is used to set up the pen color?
    9·2 answers
  • Send the memes whoever is the best will get that crown thing lol
    10·2 answers
  • TCP is a Transport-layer protocol used to communicate between applications, but it's a lightweight Transport-layer protocol, mea
    10·1 answer
  • Which Windows 7 feature allows a user to open multiple programs at the same time?
    7·1 answer
  • Given N lines of input, print the 3rd character from each line as a new line of output. It is guaranteed that each of the n line
    8·1 answer
  • News writers get story leads from____.
    8·1 answer
  • 4. Sameer appointed as journalist in big news channel. News channel has its own podcast. Explain to Sameer how podcast is useful
    11·1 answer
  • Help me plz and thank .......................................
    6·2 answers
  • what is required to successfully establish a connection between two routers using chap authentication?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!