Skip to content

Instantly share code, notes, and snippets.

View ZechCodes's full-sized avatar
🏄‍♂️
Surfing on a space-time bubble

Zech Zimmerman ZechCodes

🏄‍♂️
Surfing on a space-time bubble
View GitHub Profile
@ZechCodes
ZechCodes / challenge_132.md
Created October 16, 2020 01:18
Challenge 132 - Invert Colors

Challenge 132 - Invert Colors

Create a function that inverts the rgb values of a given tuple.

Examples

color_invert((255, 255, 255)) ➞ (0, 0, 0)
# (255, 255, 255) is the color white.
# The opposite is (0, 0, 0), which is black.
@ZechCodes
ZechCodes / challenge_131.md
Last active October 14, 2020 01:44
Challenge 131 - Let's Sort This List!

Challenge 131 - Let's Sort This List!

Create a function that takes a list of numbers, a string and return a list of numbers as per the following rules:

"Asc" returns a sorted list in ascending order (ex. 1 2 3)
"Des" returns a sorted list in descending order (ex. 3 2 1)
"None" returns a list without any modification

Examples

@ZechCodes
ZechCodes / challenge_130.md
Last active October 13, 2020 00:59
Challenge 130 - Hot Pics of Danny DeVito!

Challenge 130 - Hot Pics of Danny DeVito!

I'm trying to watch some lectures to study for my next exam but I keep getting distracted by meme compilations, TikTok, anime, and more.

Your job is to help me create a function that takes a string and checks to see if it contains the following words or phrases:

"anime"
"meme"
"tiktoks"
"roasts"
@ZechCodes
ZechCodes / challenge_129.md
Created October 12, 2020 01:35
Challenge 129 - Automorphic Numbers

Challenge 129 - Automorphic Numbers

A number n is automorphic if n**2 ends in n.

For example: n=5, n^2=25

Create a function that takes a number and returns True if the number is automorphic, False if it isn't.

Examples

@ZechCodes
ZechCodes / challenge_128.md
Created October 11, 2020 01:35
Challenge 128 - Multiplying Numbers in a String

Challenge 128 - Multiplying Numbers in a String

Given a string of numbers separated by a comma and space, return the product of the numbers.

Examples

multiply_nums("2, 3") ➞ 6

multiply_nums("1, 2, 3, 4") ➞ 24
@ZechCodes
ZechCodes / challenge_127.md
Created October 10, 2020 00:31
Challenge 127 - Retrieve the Last N Elements

Challenge 127 - Retrieve the Last N Elements

Write a function that retrieves the last n elements from a list.

Examples

last([1, 2, 3, 4, 5], 1) ➞ [5]

last([4, 3, 9, 9, 7, 6], 3) ➞ [9, 7, 6]
@ZechCodes
ZechCodes / challenge_126.md
Created October 9, 2020 01:11
Challenge 126 - Factor Chain

Challenge 126 - Factor Chain

A factor chain is a list where each previous element is a factor of the next consecutive element. The following is a factor chain:

[3, 6, 12, 36]

# 3 is a factor of 6
# 6 is a factor of 12
# 12 is a factor of 36
@ZechCodes
ZechCodes / challenge_125.md
Created October 8, 2020 03:06
Challenge 125 - Video Length in Seconds

Challenge 125 - Video Length in Seconds

You are given the length of a video in minutes. The format is mm:ss (e.g.: "02:54"). Create a function that takes the video length and returns it in seconds.

Examples

minutes_to_seconds("01:00") ➞ 60

minutes_to_seconds("13:56") ➞ 836
@ZechCodes
ZechCodes / challenge_124.md
Created October 6, 2020 00:44
Challenge 124 - Planetary Weight Converter

Challenge 124 - Planetary Weight Converter

In this challenge, you have to convert a weight weighed on a planet of the Solar System to the corresponding weight on another planet.

To convert the weight, you have to divide it by the gravitational force of the planet on which it is weighed and multiply the result (the mass) with the gravitational force of the other planet. See the table below for a list of gravitational forces:

weight on planet_a / gravitational force of planet_a * gravitational force of planet_b

Planet	  m/s²
Mercury 3.7
@ZechCodes
ZechCodes / challenge_123.md
Created October 4, 2020 15:03
Challenge 123 - List Builder

Challenge 123 - List Builder

Write a function that takes a list of multiple lists and returns one list that is made up of all the lists in the original list. Put another way you need to flatten a 2d list.

Examples

list_builder([[1, 2], [3, 4]]) ➞ [1, 2, 3, 4]

list_builder([["a", "b"], ["c", "d"]]) ➞ ["a", "b", "c", "d"]