• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 2 páginas
Resumen

Summary python

Document preview thumbnail
Vista previa 1 fuera de 2 páginas

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

Vista previa del contenido

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)

Información del documento

Subido en
26 de octubre de 2026
Número de páginas
2
Escrito en
2026/2027
Tipo
Resumen
$15.18

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
4
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes