Data Scientist | B.S. in Information Analysis from University of Michigan School of Information | linkedin.com/in/robertalterman/ | github.com/ralterman

`def get_sum(a, b):`

nums = []

nums.append(a)

nums.append(b)

return sum(nums)

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name for your function. Since the prompt tells you that the function will be taking in two numbers, be sure to include two arguments in your function declaration that will represent those numbers.

After reading the prompt, you should be thinking to yourself: *“How can I calculate a sum in Python without using + or –?”* My first thought is to use the sum function…

The *mean* and the *median* are two of the most common features used when describing numerical data. The two are known as measures of central tendency, meaning they describe a set of data by shedding light on the central position of the data. The **mean** is the average value — it’s the value that you get when you add up all of the data and divide that number by the number of points in the dataset. On the other hand, the **median** is the middle number in a set of data once it has been ordered from smallest to largest.

*…*

`def squares(n):`

for num in range(0, n):

print (num**2)

**Definitely on the easier side!*

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name for your function. Since the prompt tells you that the function will be taking in one number (n), be sure to include one argument in your function declaration that will represent that number.

In this case, a for loop is needed due to the fact that the prompt says you’re squaring all of the non-negative integers that precede the input…

- The year can be evenly divided by 4, is a leap year, unless:
- The year can be evenly divided by 100, it is NOT a leap year, unless:
- The year is also evenly divisible by 400. Then it is a leap year.

`def is_leap(year):`

leap = False

if year % 4 == 0:

if year % 100 == 0:

if year % 400 == 0:

leap = True

else:

leap = True

return leap

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name…

`def fizzBuzz(n):`

numbers = []

for num in range(1,n+1):

if (num%3 == 0) and (num%5 == 0):

numbers.append('FizzBuzz')

elif num%3 == 0:

numbers.append('Fizz')

elif num%5 == 0:

numbers.append('Buzz')

else:

numbers.append(str(num))

return numbers

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name for your function. Since the prompt tells you that the function will be taking in one number (n), be sure to include one argument in your function declaration that will represent that number.

After declaring your function, you should create an empty…

`def is_present(string, substring):`

if string.count(substring) > 0:

print ("Yes, the substring IS present.")

else:

print ("No, the substring is NOT present.")

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name for your function. Since the prompt tells you that you will be comparing two strings, be sure to include two arguments in your function declaration that will represent each string — the substring and the full string.

The key to solving this problem is figuring out how you can check if a string…

**An **anagram** is a word formed by rearranging the letters of another word*

`def anagrams(string1, string2):`

if sorted(string1) == sorted(string2):

print ("These strings ARE anagrams of each other.")

else:

print ("These strings ARE NOT anagrams of each other.")

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name for your function. Since the prompt tells you that you will be comparing two strings, be sure to include two arguments in your function declaration that will represent each string.

`def duplicates(the_list):`

dups = []

for item in the_list:

if (the_list.count(item) > 1) and (item not in dups):

dups.append(item)

return dups

Since you are asked to write a function, it’s important to do so! Right away you should type ‘def’ and come up with an appropriate name for your function. Since the prompt tells you the function will take in a list, be sure to include one argument in your function declaration that will represent this list.

Due to the fact that your input list might have more than one duplicate item, you’re going to need something to hold onto…

As a coder, you’ve likely been in the following position. You’re starting a new project and when it comes time to name your file you go with a name that you believe serves as good insight as to what the file contains. After doing some work in this file and committing it to GitHub multiple times, your file begins to resemble something not quite like its name suggests. If you choose to leave the file name the way it is, other people who check out your GitHub page can easily be misled, as its contents do not reflect its name.

The **birthday problem** (also know as the ‘birthday paradox’) is a probability theory which states that in a set of *n* randomly chosen people, at least two of them will have the same birthday. While this probability is 100% when there are at least 367 people, as there are 366 possible birthdays (including February 29th), the theory holds a 99.9% probability when there at least 70 people and even 50% when there are only 23 people involved.

While at first this might seem crazy to think that with just 23 people there’s a 50% probability that at least two of…