Task 5: 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.

Apr 26, 2025 - 07:04
 0
Task 5: Python Function

1.Write a function greet that takes a name as an argument and prints a greeting message.

Image description

2.Write a function sum_two that takes two numbers as arguments and returns their sum.

Image description

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.

Image description

4.Write a function find_max that takes two numbers as arguments and returns the larger one.

Image description

5.Write a function multiplication_table that takes a number n and prints the multiplication table for n from 1 to 10.

Image description

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.