Python Introduction
Python Introduction
❏ In Python, you can create a variable by assigning a value to it using the equal sign
(=).
❏ You can use this variable in your code to perform operations on the value it stores.
❏ The range() function also takes in another optional parameter i.e. step size. Passing
step size in a range() function is important when you want to print the value
uniformly with a certain interval.
❏ Step size is always passed as a third parameter where the first parameter is the
starting point and the second parameter is the ending point. And if the step_size is
not provided it will take 1 as a default step_size.
Loops: While Loop
❏ If the condition of a loop is always True, the loop runs for infinite times (until the
memory is full). For example:
Loops: While-Else Loop
❏ Here, the else part is executed after the condition of the loop evaluates to False.
Loops: Control Statements
Inputs
❏ The input() function is used to get input from the user. It displays a message to the
user and waits for the user to enter some text. The text entered by the user is
returned as a string.
Outputs
❏ The print() function is used to print output to the console. It can be used to print
strings, numbers, variables, and more. Multiple values can be printed using the
comma separator.
Built-in Functions
Built-in Functions
Built-in Functions
Activity I (2 hrs)
❏ Based on your understanding of this portion, you are required to write down a
python script that creates a working calculator, it is supposed to take two numbers
and an operand (+,-,*,/,**) and then perform the calculations and stores the output in
another variable and prints it.
Thank You!