Python Basics Exercises
Introduction
This lesson contains additional practice material. Go through all of the problems one by one. Don't skip anything - practice makes perfect. After all, practice is the whole point of going through this course, and of this project generally.
Exercises
- Create a function
largest_number
with a list of numbers as a parameter and return the largest number found. Do not use themax()
built-in method. - Now create a similar function but for the smallest number and name it accordingly. From now on, we won't be telling you what to name your functions but make sure to do that meaningfully.
- Define a function that receives a list of numbers and returns a new list of even numbers. Do not modify the received list.
- Make a function that receives a list of numbers and filters odd numbers. Return a modified list that the function received as a parameter.
- Create a function that receives a string and returns a dictionary with keys as the string's each character and values as the number of times that character appears in the string. For example, passing "Apple" into the function would produce
{'A': 1, 'p': 2, 'l': 1, 'e': 1}
. - Create a function that receives a string and returns a
Boolean
that indicates whether the received string is a palindrome. - Define a function that received
day
,month
, andyear
as parameters and returns aBoolean
that indicates whether that date is valid. Do not usedatetime
orcalendar
modules.