python program A year with 366 days is called a leap year. Leap years are necessary to keep the calendar in sync with the sun, because the earth revolves around the sun once very 365.25 days. As a result, years that are divisible by 4, like 1996, are leap years. However, years that are divisible by 100, like 1900, are not leap years. But years that are divisible by 400, like 2000, are leap years. Write a program named leap_year.py that asks the user for a year and computes whether that year is a leap year

Answers

Answer 1

Answer:

In Python:

year = int(input("Year: "))

if (year % 4) == 0:

  if (year % 100) == 0:

      if (year % 400) == 0:

          print("Leap year")

      else:

          print("Not a leap year")

  else:

      print("Leap year")

else:

  print("Not a leap year")

Explanation:

This line prompts user for year

year = int(input("Year: "))

This condition checks if input year is divisible by 4

if (year % 4) == 0:

If yes, this condition checks if input year is divisible by 100

  if (year % 100) == 0:

If yes, this condition checks if input year is divisible by 400

      if (year % 400) == 0:

If divisible by 4, 100 and 400, then it is a leap year

          print("Leap year")

      else:

If divisible by 4 and 100 but not 400, then it is not a leap year

          print("Not a leap year")

  else:

If divisible by 4 but not 100, then it is a leap year

      print("Leap year")

else:

If it is not divisible by, then it is not a leap year

  print("Not a leap year")


Related Questions

A structure that organizes data in a list that is commonly 1-dimensional or 2-
dimensional
Linear Section
Constant
No answertet provided
It intro technology

Answers

Answer:

An array.

Explanation:

An array can be defined as a structure that organizes data in a list that is commonly 1-dimensional or 2-dimensional.

Simply stated, an array refers to a set of memory locations (data structure) that comprises of a group of elements with each memory location sharing the same name. Therefore, the elements contained in array are all of the same data type e.g strings or integers.

Basically, in computer programming, arrays are typically used by software developers to organize data, in order to search or sort them.

Binary search is an efficient algorithm used to find an item from a sorted list of items by using the run-time complexity of Ο(log n), where n is total number of elements. Binary search applies the principles of divide and conquer.

In order to do a binary search on an array, the array must first be sorted in an ascending order.

Hence, array elements are mainly stored in contiguous memory locations on computer.

You've created a new programming language, and now you've decided to add hashmap support to it. Actually you are quite disappointed that in common programming languages it's impossible to add a number to all hashmap keys, or all its values. So you've decided to take matters into your own hands and implement your own hashmap in your new language that has the following operations:
insert x y - insert an object with key x and value y.
get x - return the value of an object with key x.
addToKey x - add x to all keys in map.
addToValue y - add y to all values in map.
To test out your new hashmap, you have a list of queries in the form of two arrays: queryTypes contains the names of the methods to be called (eg: insert, get, etc), and queries contains the arguments for those methods (the x and y values).
Your task is to implement this hashmap, apply the given queries, and to find the sum of all the results for get operations.
Example
For queryType = ["insert", "insert", "addToValue", "addToKey", "get"] and query = [[1, 2], [2, 3], [2], [1], [3]], the output should be hashMap(queryType, query) = 5.
The hashmap looks like this after each query:
1 query: {1: 2}
2 query: {1: 2, 2: 3}
3 query: {1: 4, 2: 5}
4 query: {2: 4, 3: 5}
5 query: answer is 5
The result of the last get query for 3 is 5 in the resulting hashmap.
For queryType = ["insert", "addToValue", "get", "insert", "addToKey", "addToValue", "get"] and query = [[1, 2], [2], [1], [2, 3], [1], [-1], [3]], the output should be hashMap(queryType, query) = 6.
The hashmap looks like this after each query:
1 query: {1: 2}
2 query: {1: 4}
3 query: answer is 4
4 query: {1: 4, 2: 3}
5 query: {2: 4, 3: 3}
6 query: {2: 3, 3: 2}
7 query: answer is 2
The sum of the results for all the get queries is equal to 4 + 2 = 6.
Input/Output
[execution time limit] 4 seconds (py3)
[input] array.string queryType
Array of query types. It is guaranteed that each queryType[i] is either "addToKey", "addToValue", "get", or "insert".
Guaranteed constraints:
1 ≤ queryType.length ≤ 105.
[input] array.array.integer query
Array of queries, where each query is represented either by two numbers for insert query or by one number for other queries. It is guaranteed that during all queries all keys and values are in the range [-109, 109].
Guaranteed constraints:
query.length = queryType.length,
1 ≤ query[i].length ≤ 2.
[output] integer64
The sum of the results for all get queries.
[Python3] Syntax Tips
# Prints help message to the console
# Returns a string
def helloWorld(name):
print("This prints to the console when you Run Tests")
return "Hello, " + name

Answers

Answer:

Attached please find my solution in JAVA

Explanation:

long hashMap(String[] queryType, int[][] query) {

       long sum = 0;

       Integer currKey = 0;

       Integer currValue = 0;

       Map<Integer, Integer> values = new HashMap<>();

       for (int i = 0; i < queryType.length; i++) {

           String currQuery = queryType[i];

           switch (currQuery) {

           case "insert":

               HashMap<Integer, Integer> copiedValues = new HashMap<>();

               if (currKey != 0 || currValue != 0) {

                   Set<Integer> keys = values.keySet();

                   for (Integer key : keys) {

                       copiedValues.put(key + currKey, values.get(key) + currValue);

                   }

                   values.clear();

                   values.putAll(copiedValues);

                   currValue = 0;

                   currKey = 0;

               }

               values.put(query[i][0], query[i][1]);

               break;

           case "addToValue":

               currValue += values.isEmpty() ? 0 : query[i][0];

               break;

           case "addToKey":

               currKey += values.isEmpty() ? 0 : query[i][0];

               break;

           case "get":

               copiedValues = new HashMap<>();

               if (currKey != 0 || currValue != 0) {

                   Set<Integer> keys = values.keySet();

                   for (Integer key : keys) {

                       copiedValues.put(key + currKey, values.get(key) + currValue);

                   }

                   values.clear();

                   values.putAll(copiedValues);

                   currValue = 0;

                   currKey = 0;

               }

               sum += values.get(query[i][0]);

           }

       }

       return sum;

   }

Implement the method countInitial which accepts as parameters an ArrayList of Strings and a letter, stored in a String. (Precondition: the String letter has only one character. You do not need to check for this.) The method should return the number of Strings in the input ArrayList that start with the given letter. Your implementation should ignore the case of the Strings in the ArrayList. Hint - the algorithm to implement this method is just a modified version of the linear search algorithm. Use the runner class to test your method but do not add a main method to your U7_L4_Activity_One.java file or your code will not be scored correctly.

Answers

Answer:

Answered below

Explanation:

//Program is implemented in Java

public int countInitials(ArrayList<string> words, char letter){

int count = 0;

int i;

for(i = 0; i < words.length; i++){

if ( words[i][0]) == letter){

count++

}

}

return count;

}

//Test class

Class Test{

public static void main (String args[]){

ArrayList<string> words = new ArrayList<string>()

words.add("boy");

words.add("bell");

words.add("cat");

char letter = 'y';

int numWords = countInitials ( words, letter);

System.out.print(numWords);

}

}

Last one, this is fashion marketing and I need to know the answer to get the 80%

Answers

Answer:

D. It requires that each item of stock is counted and recorded to determine stock levels

Explanation:

A perpetual system of inventory can be defined as a method of financial accounting, which involves the updating informations about an inventory on a continuous basis (in real-time) as the sales or purchases are being made by the customers, through the use of enterprise management software applications and a digitized point-of-sale (POS) equipment.

Under a perpetual system of inventory, updates of the journal entry for cost of goods sold or received would include debiting accounts receivable and crediting sales immediately as it is being made or happening.

Hence, an advantage of the perpetual system of inventory over the periodic system of inventory is that, it ensures the inventory account balance is always accurate provided there are no spoilage, theft etc.

The following are the characteristic of a perpetual inventory system;

I. It is the most popular choice for modern business.

II. Inventory is updated in near real-time.

III. It provides up-to-date balance information and requires fewer physical counts.

developed the first compiler and conducted work that led to the development of COBOL ?

Answers

Answer:

Grace Hopper.

Explanation:

Grace Hopper was a US Naval Rear Admiral and an American computer scientist who was born on the 9th of December, 1906 in New York city, United States of America. She worked on the first commercial computer known as universal automatic computer (UNIVAC), after the second World War II.

In 1953 at the Remington Rand, Grace Hopper invented the first high-level programming language for UNIVAC 1 by using words and expressions.

Additionally, the high-level programming language known as FLOW-MATIC that she invented in 1953 paved the way for the development of common business-oriented language (COBOL).

Hence, Grace Hopper developed the first compiler and conducted work that led to the development of COBOL.

What is the difference of using Selection Tool and Direct Selection Tool?

Answers

Answer:

The Selection tool will always select the object as a whole. Use this tool when you want to manipulate the entire object. The Direct Selection tool will always select the points or segments that make up a frame

Explanation:

Approximately how many numeric IP addresses are possible with IPv4?

4 billon

Answers

Answer:

4,294,967,296 (~4.3B)

Explanation:

IPv4 uses 32-bits for representing addresses, thus you can have 2^32 total combinations.

5. All sites are required to have the following reference materials available for use at VITA/TCE sites in paper or electronic format: Publication 17, Publication 4012, Volunteer Tax Alerts (VTA), and Quality Site Requirement Alerts (QSRA). AARP Foundation Tax Aide uses CyberTax Alerts in lieu of VTAs and QSRAs. What other publication must be available at each site and contains information about the new security requirements at sites

Answers

Answer:

Publication 5140.

Explanation:

The acronym VITA stands for Volunteer Income Tax Assistance and TCE stands for Tax Counseling for the Elderly. VITA/TCE is a certification gotten from the Internal Revenue Service in which the holders of such certification are trained on how to help people that have disabilities or that their incomes earners that are low. These volunteers help these set of people to prepare for their tax return.

In order to make the volunteers to be able to perform their work with high accuracy, the Department of Treasury, Internal Revenue Service gave out some aids for Quality Site. One of the aids which is the one contains information about the new security requirements at sites is given in the Publication 5140.

let m be a positive integer with n bit binary representation an-1 an-2 ... a1a0 with an-1=1 what are the smallest and largest values that m could have

Answers

Answer:

Explanation:

From the given information:

[tex]a_{n-1} , a_{n-2}...a_o[/tex] in binary is:

[tex]a_{n-1}\times 2^{n-1} + a_{n-2}}\times 2^{n-2}+ ...+a_o[/tex]

So, the largest number posses all [tex]a_{n-1} , a_{n-2}...a_o[/tex]  nonzero, however, the smallest number has [tex]a_{n-2} , a_{n-3}...a_o[/tex] all zero.

The largest = 11111. . .1 in n times and the smallest = 1000. . .0 in n -1 times

i.e.

[tex](11111111...1)_2 = ( 1 \times 2^{n-1} + 1\times 2^{n-2} + ... + 1 )_{10}[/tex]

[tex]= \dfrac{1(2^n-1)}{2-1}[/tex]

[tex]\mathbf{=2^n -1}[/tex]

[tex](1000...0)_2 = (1 \times 2^{n-1} + 0 \times 2^{n-2} + 0 \times 2^{n-3} + ... + 0)_{10}[/tex]

[tex]\mathbf {= 2 ^{n-1}}[/tex]

Hence, the smallest value is [tex]\mathbf{2^{n-1}}[/tex] and the largest value is [tex]\mathbf{2^{n}-1}[/tex]

Other Questions
Find the product of (1)(3)(x).Youranswer The weight of a baby dog on day one is 5 kilograms. Every day, the dog grows an additional 0.1 kilograms. How heavy the dog is after 10 days? Solve the simultaneous equations8x + 3y = 452x + 3y = 27 6. Despite multimillion-dollar investments, many IT organizations cannot respond quickly to evolving business needs. Also, they cannot adapt to large-scale shifts like mergers, sudden drops in sales, or new product introductions. Can cloud computing help organizations improve their responsiveness and get better control of their IT costs He is know for making mockery of people from other races Item 5 Which sentence is correct?Books like "Hidden Figures' motivate us by describing the real-life achievements of others,o Books like Hidden Figures motivate us by describing the real-life achievements of others.Books like Hidden Figures motivate us by describing the real-life achievements of others.Books like Hidden Figures motivate us by describing the real-life achievements of others. Describe what a shatter belt is in your own words. GIVE 15 BRAINLY: Which writing purpose will most likely require an informal style A radioactive substance has a half-life of 5 million years. What is the age of a rock in which 25% of the original radioactive atoms remain Which of the following values are solutions to the inequality - 8 - 3x > 2?I. 2II. 12III. 5 Which function represents the graph of y = 3(1/2)^xbd Let N* be the total number of ranchers in Uruguay, and N(t) be the number of ranchers who have adopted an improved pasture technology there. Assume that the rate of adoption, , is proportional to both the number who have adopted the technology and the fraction of the ranchers who have not (and so are susceptible to conversion). Let a be the proportionality constant.a. Write down the differential equation modeling N(t).b. According to Banks (1993), N* = 17000, N(0) = 170, a = 0.5 per year.Determine how long it takes for the improved pasture technology to spread to 80% of the population of the ranchers. A 2-pound package of hamburger costs $7.00, and you pay $10.50 for a 3-pound package of hamburger. Use a double number line to complete the table.Weight (lb)2345Cost ($)7.0010.5014.0017.50What is the unit rate in this relationship? Define the terms heredity and inherited in your own words. simple 9th grade math Help pleas brainliest promise Maes Howe: A Twofold Treasure"Maes Howe, a chambered tomb located in Scotland's Orkney Islands, is older than the pyramids. Built fromenormous stones, the tomb has one long, narrow entrance with a ceiling so low that visitors must hunch over asthey pass through it. The entrance faces toward the winter sun's location at sunset around the shortest day of theyear.Ancient rituals were performed there. Long after it was abandoned by its builders, Vikings broke into MaesHowe and left runes carved in its walls. The collection of runesViking graffiti-shares sentiments familiar in anytime: "Ingigerth is the most beautiful of women"; "Haermund Hardaxe carved these runes." What looks from theoutside to be simply a round, grassy hill on a small, wind-swept island represents an amazing historical find fortwo different eras.Explain why the following inference is true or false."The builders of Maes Howe considered the winter sun important." PLEASE HELPPPUse the following words to compose complete sentences. Make all the necessary changes to ensure agreement.18. Quel / pomes / tu / apprendre19. Ils / crire / ce / notes20. Vous / dire / rienAnswer the following questions using the hints in parentheses. Compose complete sentences.11. Quelqu'un est venu? (No, nobody)14. Tu veux encore de la salade? (No, no more) slove for y . 3x+2y=-6 In order to prove that the Law of Conservation Mass is obeyed, what are the coefficientsneeded to balance the following reaction:C3Hg +021CO2 +H2O