Function & Looping Python Programming Language
In Python, a function is a group of related statements that performs a specific task. It help us work faster, simplify our code and avoids repetition.
It takes in an input. It does something to that input. It gives back an output. Generally, a function displays this pattern:
STRUCTURE OF A FUNCTION
Built-in functions - Functions that are built into Python. Ex: sum(), max(), etc. User-defined functions - Functions defined by the users themselves. Basically, we can divide functions into the following two types: 1. 2. TYPE OF FUNCTION
Python offers us an easy way to repeat a process, which helps us when we need to repeat a process hundreds, thousands, or even millions of times. Let's say we have a list [3, 5, 1, 2] assigned to a variable ratings, and we want to repeat the following process: for each element in ratings, print its index and itself. This is how we could translate that into Python syntax: LOOPING IN PYTHON
The technique used previously is called a loop, because we always start with for (like in for some_variable in some_list:), this technique is known as a for loop. STRUCTURE OF LOOPING
PIPELINE TEAM INES DESDEMARSA NOVITA SARI

Python Function and Looping

  • 1.
  • 2.
    In Python, a functionis a group of related statements that performs a specific task. It help us work faster, simplify our code and avoids repetition.
  • 3.
    It takes inan input. It does something to that input. It gives back an output. Generally, a function displays this pattern:
  • 4.
  • 5.
    Built-in functions -Functions that are built into Python. Ex: sum(), max(), etc. User-defined functions - Functions defined by the users themselves. Basically, we can divide functions into the following two types: 1. 2. TYPE OF FUNCTION
  • 6.
    Python offers usan easy way to repeat a process, which helps us when we need to repeat a process hundreds, thousands, or even millions of times. Let's say we have a list [3, 5, 1, 2] assigned to a variable ratings, and we want to repeat the following process: for each element in ratings, print its index and itself. This is how we could translate that into Python syntax: LOOPING IN PYTHON
  • 7.
    The technique used previouslyis called a loop, because we always start with for (like in for some_variable in some_list:), this technique is known as a for loop. STRUCTURE OF LOOPING
  • 8.