• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 2 pages
Summary

Summary python

Document preview thumbnail
Preview 1 out of 2 pages

Summary of 2 pages for the course Data Science & online sales at Data Science & online sales (about python)

Content preview

Python Function Assignments
Section A: Basics of Functions

1. Create a function greet() that prints "Hello, Welcome to Python!"
2. Create a function add() that takes two numbers and returns their sum.
3. Create a function is_even(num) that returns True if the number is even, else False.
4. Write a function to calculate the square of a number.
5. Create a function that prints all even numbers from 1 to N.



Section B: Parameters and Return Values

6. Write a function multiply(a, b) that returns the product of two numbers.
7. Create a function power(base, exponent) to calculate base^exponent.
8. Define a function is_prime(n) to check if a number is prime.
9. Write a function that accepts marks and returns grade:
o 90+ → A
o 80-89 → B
o 70-79 → C
o else → D
10. Create a function that accepts a name and age, and returns a formatted string:
"Hi [Name], you are [Age] years old."




Section C: String and List Functions

11. Write a function to count vowels in a string.
12. Write a function reverse_string(s) to return the reversed string.
13. Write a function that accepts a list and returns only odd numbers from it.
14. Write a function that returns the largest element in a list.
15. Write a function that takes a string and returns its word count.



Section D: Special Features

16. Write a function using *args to calculate the sum of all arguments.
17. Write a function using **kwargs to print all key-value pairs.
18. Create a lambda function to multiply two numbers.
19. Use map() to convert all words in a list to uppercase.
20. Use filter() to extract all numbers greater than 50 from a list.
21. Use reduce() to find the product of all elements in a list.



Section E: Mini Projects (Functions-Based)

Document information

Uploaded on
October 26, 2026
Number of pages
2
Written in
2026/2027
Type
Summary
$15.19

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
4
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions