Answer:
I'm not a big tech head but I know that creating a restore point is highly recommended for changing anything that you aren't 100% sure about to your computer.
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
<span>Instance variables are declared private to prevent direct modification. Access to the variables is instead provided through methods. This practice is known as..
</span><span>c. encapsulation. It </span><span>is a mechanism of bundling the data (variables) and code acting on the data (methods) together as one.</span>
Answer:
In the given question the correct option is missing, which can be described as follows:
"It transforms binary, null variables into the groups."
Explanation:
These variables are real variables, which could also take up a series of variables, that are either constrained or defined. This can be regarded as a listing. It is used to analyze and convert it, into binary in the following ways, and wrong choices can be described as follows:
- In option a, It can't combine, it only converts.
- Option b and Option c is wrong because, it can't convert numeric, it only convert binary number to dummy variables.
Answer:
Explanation:
The following is written in Python. It takes in a file, it then reads all of the elements in the file and adds them to a list called myList. Then it sorts the list and uses the elements in that list to calculate the median. Once the median is calculated it returns it to the user. The code has been tested and the output can be seen in the image below.
def find_median(file):
file = open(file, 'r')
mylist = []
for number in file:
mylist.append(int(number))
numOfElements = len(mylist)
mylist.sort()
print(mylist)
if numOfElements % 2 == 0:
m1 = numOfElements / 2
m2 = (numOfElements / 2) + 1
m1 = int(m1) - 1
m2 = int(m2) - 1
median = (mylist[m1] + mylist[m2]) / 2
else:
m = (numOfElements + 1) / 2
m = int(m) - 1
median = mylist[m]
return median
print("Median: " + str(find_median('file1.txt')))