0% found this document useful (0 votes)
3 views1 page

Python Coding Exercises and Solutions

The document contains a series of Python programming tasks, including creating functions to check if a number is even, calculate the area of a circle, and format names. It also includes instructions for writing a main program that utilizes a separate module for multiplication and for printing integers divisible by both 2 and 3. Each task emphasizes the use of conditional statements, mathematical calculations, and proper string formatting.

Uploaded by

Prottay Proshad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Python Coding Exercises and Solutions

The document contains a series of Python programming tasks, including creating functions to check if a number is even, calculate the area of a circle, and format names. It also includes instructions for writing a main program that utilizes a separate module for multiplication and for printing integers divisible by both 2 and 3. Each task emphasizes the use of conditional statements, mathematical calculations, and proper string formatting.

Uploaded by

Prottay Proshad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Test Question

1. Write a Python code that takes an integer as input and returns True if the number is
even, and False otherwise. Use conditional statements to implement this function.

2. Create a Python function called calculate_area_circle that calculates and returns the
area of a circle given its radius as input. Use the formula: area = π × radius 2
area=π×radius 2 . Import the math module to access the value of π.

3. Write a Python program where you have a main file called [Link] and a module file
called [Link]. In [Link], define a function called multiply that takes two
numbers as arguments and returns their product. In [Link], import the operations
module and use the multiply function to multiply two numbers input by the user.

4. Write a Python program that prompts the user to enter a positive integer n, then prints
all the positive integers less than or equal to n that are divisible by both 2 and 3.

5. Create a Python function called format_name that takes two string arguments:
first_name and last_name. The function should return a formatted string in the format
"Last Name, First Name". Ensure that both first_name and last_name are properly
capitalized before formatting.

You might also like