Skip to content

SJ-Coding-Club/May-Contest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

May Contest

Problem 0: num-sum

Write a program that computes the sum of all consecutive integers from 1 to 100 without simply doing 1 + 2 + 3 + ... + 100. There are multiple ways to do this, but one way is most efficient.

Problem 1: counting-leaps

A leap year occurs on any year that is divisible by 4, except for century years (like 1900), which must be divisible by 400 to be considered leap years. Write a program that calculates the number of leap years that occurred between 1430 and 2021.

Problem 2: n-factorial

The factorial of n, denoted as n!, is the product of n and every positive integer below it.

# For example:
1! = 1
2! = 2 * 1 = 2
3! = 3 * 2 * 1 = 6
4! = 4 * 3 * 2 * 1 = 24
5! = 5 * 4 * 3 * 2 * 1 = 120

Write a program that takes any integer n as input and calculates n!

Problem 3: high-low-average

Write a program that takes an unsorted list of 5 numbers as input and returns the average of the highest number and the lowest number.

# Example
>>> high_low_average([5,4,2,8,3])
5.0

Problem 4: most-common-char

Write a program that takes a string of characters as input and returns the single most common letter in the statement.

# Examples
>>> most_common_char('hello')
'l'
>>> most_common_char('Lemonade')
'e'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published