title-img


Mini-Max Sum

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. arr = [1,3,5,7,9] Example The minimum sum is 1 + 3 + 5 + 7 = 16 and the maximum sum is 3 + 5 + 7 + 9 = 24. the function prints 16 24 . Function Description Complete the miniMaxSum function in the editor below. miniMaxSum has the following

View Solution →

Python: Division

The provided code stub reads two integers, a and b, from STDIN. Add logic to print two lines. The first line should contain the result of integer division, a//b . The second line should contain the result of float division, a/b . No rounding or formatting is necessary. Example: The result of the integer division 3//5=0. The result of the float division is 3/5=0.6. Print: 0 0.6 Input Format: The first line contains the first integer, a.

View Solution →

Birthday Cake Candles

You are in charge of the cake for a child's birthday. You have decided the cake will have one candle for each year of their total age. They will only be able to blow out the tallest of the candles. Count how many candles are tallest. Example candles = [4,4,1,3] The maximum height candles are 4 units high. There are of 2 them, so return 2. Function Description Complete the function birthdayCakeCandles in the editor below. birthdayCakeCandles has the following parameter(s):

View Solution →

Loops

Task: The provided code stub reads and integer, n , from STDIN. For all non-negative integers i<n, print i^2. Example: n=3 The list of non-negative integers that are less than n=3 is [0,1,2] . Print the square of each number on a separate line. 0 1 4 Input Format: The first and only line contains the integer, n. Constraints: 1<=n<=20 Output Format: Print n lines, one corresponding to each i.

View Solution →

Write a function

An extra day is added to the calendar almost every four years as February 29, and the day is called a leap day. It corrects the calendar for the fact that our planet takes approximately 365.25 days to orbit the sun. A leap year contains a leap day. In the Gregorian calendar, three conditions are used to identify leap years: 1.The year can be evenly divided by 4, is a leap year, unless: 2.The year can be evenly divided by 100, it is NOT a leap year, unless: 3.The year i

View Solution →