python exercises with solutions book code example

Example 1: python function exercises

Exercise 1: Create a function that can accept two arguments name and 
  age and print its value
Exercise 2: Write a function func1() such that it can accept a variable 
  length of  argument and print all arguments value
Exercise 3: Write a function calculation() such that it can accept two 
  variables and calculate the addition and subtraction of them. And a
  lso it must return both addition and subtraction in a single return 
  call
Exercise 4: Create a function showEmployee() in such a way that it 
  should accept employee name, and its salary and display both. 
  If the salary is missing in the function call assign default value 
  9000 to salary
Exercise 5: Create an inner function to calculate the addition in the 
  following way
Exercise 6: Write a recursive function to calculate the sum of numbers 
  from 0 to 10
Exercise 7: Assign a different name to function and call it through the 
  new name
Exercise 8: Generate a Python list of all the even numbers between 4 to 
  30
Exercise 9: Return the largest item from the given list
  
⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️ GOTO URL FOR PRACTICE ⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️⤵️
https://pynative.com/python-functions-exercise-with-solutions/

Example 2: exercises with classes in python with solutions

class Vehicle:

    def __init__(self, name, max_speed, mileage):
        self.name = name
        self.max_speed = max_speed
        self.mileage = mileage