Python User Function Exercises
Let’s check out some exercises that will help understand “Defining Functions” better.
Exercise 16-a
Define a function named f_1 which will print "Hello World!"
Exercise 16-b
Now define the same function f_1 and assign it to variable ans_1. See what happens.
Exercise 16-c
Now define the same f_1 function this time so that it returns a value instead of just printing it..
Exercise 16-d
Now create a function named f_1 which both prints and returns "Hello World!"
Exercise 16-e
Create a function named f_1 which always returns the number: 100 .
Exercise 16-f
Create a function named f_1 which takes an integer as input and then returns it.
Exercise 16-g
Can you define a function that takes a list as input and returns the reverse of that list?
Exercise 16-h
Write a function named f_1 which will ask user for their name and print Hello!, Name
Exercise 16-i
Write 2 functions named f_1 and f_2. First one takes a number as input and returns that number +5, second function takes a number as input and returns first function's result multiplied by 2.