This program will print a range of factorials from 0 to the number given by the user. I begin by defining my function. Every recursive function has two major cases: a base case, and a recursive case. In this program, the base case is x being less then or equal to 1. The recursive case…
Tag: Python
Bricks – Pygame
I made this project as a birthday gift to my awesome older brother, Max. He helps me learn programming in his spare time, and is always very supportive towards me. Moreover, this was a great opportunity to learn more about the structure of the PyGame library. Originally, this project came from the book “Python, PyGame…
Climbing Snail – Python Challenge
A snail climbs a pole, “H” meters in height. It climbs up “A” meters during the day, and slides down “B” meters during the night. It is known that A > B, and B is greater than or equal to 0. On which day, will the snail reach the top of the pole? My solution…
Digital Clock Python Challenge
The goal of this Python challenge was to create a program which would convert the amount of seconds given by the user (starting from 0:00), to an h:mm:ss notation. The amount of hours must not go over 23, just like on a digital clock. My solution is displayed below. First, the program takes in the…
Updatable Clipboard – Python Project
The goal of this project was to create a program that uses the shelf module in order for the user to be able to save copied text under a keyword, and then retrieve it by typing the keyword in the program – which then pastes the text in to the clipboard. As an an addition…
Regular Expressions – Date Detector
This python program used regular expressions to determine whether a given date is correct or not. Leap years and days in a month are calculated as well. First, we can import re, and any other library that might be useful. In order to check whether a date is correct, we need to know how many…
Buggy Code Part1
Challenge 014 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 Solution
To the Power of _____
Challenge 013 Create a function that takes a base number and an exponent number and returns the calculation. Examples Solution
Return a String as an Integer
Challenge 012 Create a function that takes a string and returns it as an integer. Examples Solution
Convert Hours Into Seconds
Challenge 011 Write a function that converts hours into seconds. Examples Solution
Return the First Element in a List
Challenge 010 Create a function that takes a list and returns the first element. Examples Solution
Find the Perimeter of a Rectangle
Challenge 009 Create a function that takes length and width and finds the perimeter of a rectangle. Examples Solution
Area of a Triangle
Challenge 008 Write a function that takes the base and height of a triangle and return its area. Examples Solution
Maximum Edge of a Triangle
Challenge 007 Create a function that finds the maximum range of a triangle’s third edge, where the side lengths are all integers. Examples Solution
Convert Age to Days
Challenge 006 Create a function that takes the age and return the age in days. Examples Solution
Return the First Element in a List
Challenge 005 Create a function that takes a list and returns the first element. Examples Solution
Convert Hours and Minutes Into Seconds
Challenge 004 Write a function that takes two integers (hours, minutes), converts them to seconds, and adds them. Examples Solution
Return the Remainder from Two Numbers
Challenge 003 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 Solution
Convert Minutes into Seconds
Challenge 002 Write a function that takes an integer minutes and converts it to seconds. Solution
Return the Next Number from the Integer Passed
Challenge 001 Create a function that takes a number as an argument, increments the number by +1 and returns the result. Examples Solution:
Return the Sum of Two Numbers
Challenge 000 Create a function that takes two numbers as arguments and return their sum. Examples Solution: