Parottasalna

AI, Backend Engineering & Architecture Guides

Tasks – Python Function()

  1. Write a function greet that takes a name as an argument and prints a greeting message.
  2. Write a function sum_two that takes two numbers as arguments and returns their sum.
  3. Write a function is_even that takes a number as an argument and returns True if the number is even, and False if it is odd.
  4. Write a function find_max that takes two numbers as arguments and returns the larger one.
  5. Write a function multiplication_table that takes a number n and prints the multiplication table for n from 1 to 10.
  6. Write a function celsius_to_fahrenheit that takes a temperature in Celsius and returns the temperature in Fahrenheit.
  7. Write a function power that takes two arguments, a number and an exponent, and returns the number raised to the given exponent. The exponent should have a default value of 2.

Discover more from Parottasalna

Subscribe now to keep reading and get access to the full archive.

Continue reading