Answer:
def leap_year(y):
if y % 4 == 0:
return 1
else:
return 0
def number_of_days(m,y):
if m == 2:
return 28 + leap_year(y)
elif m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m ==10 or m == 12:
return 31
elif m == 4 or m == 6 or m == 9 or m == 11:
return 30
def days(m,d):
if m == 1:
return 0 + d
if m == 2:
return 31 + d
if m == 3:
return 59 + d
if m == 4:
return 90 + d
if m == 5:
return 120 + d
if m == 6:
return 151 + d
if m == 7:
return 181 + d
if m == 8:
return 212 + d
if m == 9:
return 243 + d
if m == 10:
return 273 + d
if m == 11:
return 304 + d
if m == 12:
return 334 + d
def days_left(d,m,y):
if days(m,d) <= 60:
return 365 - days(m,d) + leap_year(y)
else:
return 365 - days(m,d)
print("Please enter a date")
day=int(input("Day: "))
month=int(input("Month: "))
year=int(input("Year: "))
choice=int(input("Menu:\n1) Calculate the number of days in the given month.\n2) Calculate the number of days left in the given year.\n"))
if choice == 1:
print(number_of_days(month, year))
if choice == 2:
print(days_left(day,month,year))
Explanation:
Hoped this helped
Corrected or Complet Question
The ____ operator executes one of two expressions based on the results of a conditional expression.
a. .
b. ( )
c. ,
d. ?:
Answer:
(d) ? :
Explanation:
The ternary operator (? :) is an operator that executes one out of two expressions based on the results of a conditional expression. It is a faster or shorthand way of writing an if ... else statement. The operator checks the conditional expression and depending on whether it is true or false, one of its two statements will be executed. For example:
String correct = (4 < 5) ? "yes" : "no" ;
In the code above,
i. the conditional statement is (4 < 5) and this will be tested for to return true or false.
ii. the first expression (the one after the ?) is "yes" which will be executed if the conditional statement returns true.
iii. and the second expression (the one after the : ) is "no" which will be executed if the conditional statement returns false.
Therefore, since the conditional expression returns true for 4 < 5, the first expression will be executed. i.e "yes". This means that the String variable <em>correct </em> will have a value of "yes".
The options were:
-malware
-spam
-Denial of Service
-Hacking
The correct answer would be Malware. Here is why: Malware refers to a program or script that will affect a target device in a negative way, it cant be hacking because it is a topic, not a tool. Denial of Service is a type of attack that temporarily shuts down servers after a number of requests a device(s) make exceeds the number of requests it can take in a certain amount of time. Spam is either an advertising email from a third party company that bought your email from a list server from a service you gave your info to, like Facebook. Or spam could be a social engineering attack sent by someone trying to harvest your credentials from an email source your email server found untrustworthy.
Please message me if you need any more help with this stuff, I am doing a lot of hacking projects right now and I think I would be a great contact!
Hope this helped!
Answer:
ARP is a simple query–response packet protocol used to match workstations hardware addresses to IP addresses. In other words, ARP is the protocol used to identify nodes in a LAN. ARP is described in RFC 826