edabit.com

Add to bookmarks

Add to collection

How Edabit Works

This is an introduction to how challenges on Edabit work. In the Code tab above you'll see a starter function that looks like this: def hello(): All you have to do is type return "hello edabit.com" on the second line and then click the Check button. If you did this correctly, the button will turn red and say SUBMIT FINAL. …

language_fundamentals

strings

Very Easy

Add to bookmarks

Add to collection

Return the Sum of Two Numbers

Create a function that takes two numbers as arguments and returns their sum. Examples addition(3, 2) ➞ 5 addition(-3, -6) ➞ -9 addition(7, 3) ➞ 10 Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the Solutions tab.

algebra

language_fundamentals

math

numbers

Very Easy

Add to bookmarks

Add to collection

Return the Next Number from the Integer Passed

Create a function that takes a number as an argument, increments the number by +1 and returns the result. Examples addition(0) ➞ 1 addition(9) ➞ 10 addition(-3) ➞ -2 Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the So …

algebra

math

numbers

Very Easy

Add to bookmarks

Add to collection

Convert Minutes into Seconds

Write a function that takes an integer minutes and converts it to seconds. Examples convert(5) ➞ 300 convert(3) ➞ 180 convert(2) ➞ 120 Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the Solutions tab.

language_fundamentals

math

numbers

Very Easy

Add to bookmarks

Add to collection

Area of a Triangle

Write a function that takes the base and height of a triangle and return its area. Examples tri_area(3, 2) ➞ 3 tri_area(7, 4) ➞ 14 tri_area(10, 10) ➞ 50 Notes The area of a triangle is: (base * height) / 2 Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really …

geometry

math

numbers

Very Easy

Add to bookmarks

Add to collection

Buggy Code (Part 1)

Fix the code in the code tab to pass this challenge (only syntax errors). Look at the examples below to get an idea of what the function should do. Examples cube(3) ➞ 27 cube(5) ➞ 125 cube(10) ➞ 1000 Notes READ EVERY WORD CAREFULLY, CHARACTER BY CHARACTER! Don't overthink this challenge; it's not supposed to be hard.

bugs

language_fundamentals

Very Easy

Add to bookmarks

Add to collection

Convert Hours into Seconds

Write a function that converts hours into seconds. Examples howmanyseconds(2) ➞ 7200 howmanyseconds(10) ➞ 36000 howmanyseconds(24) ➞ 86400 Notes 60 seconds in a minute, 60 minutes in an hour Don't forget to return your answer.

language_fundamentals

math

numbers

Very Easy

Add to bookmarks

Add to collection

Maximum Edge of a Triangle

Create a function that finds the maximum range of a triangle's third edge, where the side lengths are all integers. Examples next_edge(8, 10) ➞ 17 next_edge(5, 7) ➞ 11 next_edge(9, 2) ➞ 10 Notes (side1 + side2) - 1 = maximum range of third edge. The side lengths of the triangle are positive integers. Don't forget to retu …

algorithms

math

numbers

Very Easy

Add to bookmarks

Add to collection

Return the Remainder from Two Numbers

There is a single operator in Python, capable of providing the remainder of a division operation. Two numbers are passed as parameters. The first parameter divided by the second parameter will have a remainder, possibly zero. Return that value. Examples remainder(1, 3) ➞ 1 remainder(3, 4) ➞ 3 remainder(5, 5) ➞ 0 remainde …

math

numbers

Very Easy

Add to bookmarks

Add to collection

Return a String as an Integer

Create a function that takes a string and returns it as an integer. Examples string_int("6") ➞ 6 string_int("1000") ➞ 1000 string_int("12") ➞ 12 Notes All numbers will be whole. All numbers will be positive.

language_fundamentals

numbers

strings

Very Easy

Add to bookmarks

Add to collection

Convert Age to Days

Create a function that takes the age and return the age in days. Examples calc_age(65) ➞ 23725 calc_age(0) ➞ 0 calc_age(20) ➞ 7300 Notes Use 365 days as the length of a year for this challenge. Ignore leap years and days between last birthday and now. Expect only positive integer inputs.

math

numbers

Very Easy

Add to bookmarks

Add to collection

Find the Perimeter of a Rectangle

Create a function that takes length and width and finds the perimeter of a rectangle. Examples find_perimeter(6, 7) ➞ 26 find_perimeter(20, 10) ➞ 60 find_perimeter(2, 9) ➞ 22 Notes Don't forget to return the result. If you're stuck, find help in the Resources tab. If you're really stuck, find solutions in the Solutions tab.

geometry

language_fundamentals

math

numbers

Very Easy

Add to bookmarks

Add to collection

Power Calculator

Create a function that takes voltage and current and returns the calculated power. Examples circuit_power(230, 10) ➞ 2300 circuit_power(110, 3) ➞ 330 circuit_power(480, 20) ➞ 9600 Notes Requires basic calculation of electrical circuits (see Resources for info).

math

numbers

Very Easy

Add to bookmarks

Add to collection

Sum of Polygon Angles

Given an n-sided regular polygon n, return the total sum of internal angles (in degrees). Examples sum_polygon(3) ➞ 180 sum_polygon(4) ➞ 360 sum_polygon(6) ➞ 720 Notes n will always be greater than 2. The formula (n - 2) x 180 gives the sum of all the measures of the angles of an n-sided polygon.

functional_programming

math

numbers

Very Easy

Add to bookmarks

Add to collection

To the Power of _____

Create a function that takes a base number and an exponent number and returns the calculation. Examples calculate_exponent(5, 5) ➞ 3125 calculate_exponent(10, 10) ➞ 10000000000 calculate_exponent(3, 3) ➞ 27 Notes All test inputs will be positive integers. Don't forget to return the result. If you get stuck on a challenge …

logic

loops

math

numbers

Very Easy

Add to bookmarks

Add to collection

Boolean to String Conversion

Create a function that takes a boolean variable flag and returns it as a string. Examples booltostring(True) ➞ "True" booltostring(False) ➞ "False" Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the Solutions tab.

bit_operations

conditions

logic

strings

Very Easy

Add to bookmarks

Add to collection

Correct the Mistakes

Fix the code in the code tab to pass this challenge (only syntax errors). Look at the examples below to get an idea of what the function should do. Examples squared(5) ➞ 25 squared(9) ➞ 81 squared(100) ➞ 10000 Notes READ EVERY WORD CAREFULLY, CHARACTER BY CHARACTER! Don't overthink this challenge; it's not supposed to be …

algebra

bugs

language_fundamentals

Very Easy

Add to bookmarks

Add to collection

Return the First Element in a List

Create a function that takes a list containing only numbers and return the first element. Examples getfirstvalue([1, 2, 3]) ➞ 1 getfirstvalue([80, 5, 100]) ➞ 80 getfirstvalue([-500, 0, 50]) ➞ -500 Notes The first element in a list always has an index of 0.

arrays

language_fundamentals

Very Easy

Add to bookmarks

Add to collection

Football Points

Create a function that takes the number of wins, draws and losses and calculates the number of points a football team has obtained so far. wins get 3 points draws get 1 point losses get 0 points Examples football_points(3, 4, 2) ➞ 13 football_points(5, 0, 2) ➞ 15 football_points(0, 0, 1) ➞ 0 Notes Inputs will be numbers …

algebra

math

numbers

Very Easy

Add to bookmarks

Add to collection

The Farm Problem

In this challenge, a farmer is asking you to tell him how many legs can be counted among all his animals. The farmer breeds three species: chickens = 2 legs cows = 4 legs pigs = 4 legs The farmer has counted his animals and he gives you a subtotal for each species. You have to implement a function that returns the total nu …

algorithms

language_fundamentals

math

Very Easy

Read the original on edabit.com ↗