DEV Community

Pradeep Pep
Pradeep Pep

Posted on

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

Image description

6.Write a function celsius_to_fahrenheit that takes a temperature in Celsius and returns the temperature in Fahrenheit.

Image description

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.

Image description

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil — patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now

👋 Kindness is contagious

DEV shines when you're signed in, unlocking a customized experience with features like dark mode!

Okay