A few exercises to learn Python in a fun way!
Exercise 01: create a python program that takes 2 values and then select between sum and sub. Show the result.
Exercise 02: like the exercise 01, but adding multiplication and division. Must be used a function with 3 values: number 1, number 2 and the arithmetic. List the possibles arithmetics (a letter to each one). You can not use else. The function can have any number of returns needed. Show a error message if the arithmetic doesn't exist.
Exercise 03: create a program to act like some dice. Take input that says how many sides the dice should have. Output the dice roll.
Exercise 04: like exercise 03, but extended to allow the user to input how many dice they'd like to roll. Roll and output each dice, then if the number of dice is greater than 1, output the total of all the dice.
Exercise 05: higher or lower game - the computer chooses a random number between 1 and n
(you choose what n
is). The user then can make guesses at what the number is. If their guess is correct, it outputs that they win. If it is incorrect, it outputs whether the target number is higher or lower than their guess.
To contribute send a PR with some fun exercises to be done in Python.
- Add the exercise
- Add your username with the link to your porofile on GitHub (see the list above)
Let's have fun and learn!