0% found this document useful (0 votes)
7 views3 pages

Python Functions Practice Assignment

The document outlines a Python functions assignment with seven tasks aimed at practicing function creation and usage. Tasks include greeting a user, calculating the area of a rectangle, checking if a number is even or odd, converting Celsius to Fahrenheit, finding the largest number in a list, printing a multiplication table, and creating a simple calculator. Instructions emphasize defining, testing, commenting, and submitting the functions in a single Python file.

Uploaded by

Somebody's Bae
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)
7 views3 pages

Python Functions Practice Assignment

The document outlines a Python functions assignment with seven tasks aimed at practicing function creation and usage. Tasks include greeting a user, calculating the area of a rectangle, checking if a number is even or odd, converting Celsius to Fahrenheit, finding the largest number in a list, printing a multiplication table, and creating a simple calculator. Instructions emphasize defining, testing, commenting, and submitting the functions in a single Python file.

Uploaded by

Somebody's Bae
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 Functions Assignment**

#### **Objective:**
To practice creating and using functions in Python to perform a variety of tasks.

---

### **Task 1: Greet the User**


Write a function called `greet_user` that takes a user's name as an argument and prints a
greeting message.

**Example:**

### **Task 2: Calculate the Area of a Rectangle**


Create a function called `calculate_area` that takes two arguments, `length` and `width`, and
returns the area of a rectangle.

**Example:**

---

### **Task 3: Check if a Number is Even or Odd**


Write a function named `is_even` that takes a single integer as an argument and returns `True`
if the number is even, and `False` if it’s odd.

**Example:**
---

### **Task 4: Convert Temperature from Celsius to Fahrenheit**


Create a function called `celsius_to_fahrenheit` that converts a temperature given in Celsius to
Fahrenheit. The formula is:
\[ \text{Fahrenheit} = \left(\text{Celsius} \times \frac{9}{5}\right) + 32 \]

**Example:**

---

### **Task 5: Find the Largest Number in a List**


Write a function named `find_largest` that takes a list of numbers and returns the largest
number.

**Example:**

---
### **Task 6: Print a Multiplication Table**
Create a function called `print_table` that takes a number as an argument and prints the
multiplication table for that number up to 10.

**Example:**

---

### **Task 7: Simple Calculator**


Expand on the calculator task by creating a function `simple_calculator` that can handle
addition, subtraction, multiplication, and division as in the previous task.

---

### **Instructions:**

1. **Define each function** according to the task description.


2. **Test your functions** with different inputs to ensure they work correctly.
3. **Comment your code** to explain what each part does.
4. **Submit your assignment** with all functions in a single Python file.

---

You might also like