Python Programming[1]
Python Programming[1]
Dr Dan
01
DATA TYPES
02
VARIABLES
iNTRODUCTION 03
OPERATORS
TO PYTHON 04
CONDITIONAL
STATEMENTS
Python is a high-level programming
language that is widely used in various
fields, including data 05
LOOPS
science, web development, and artificial
intelligence. Some of the key elements of
06
FUNCTIONS
Python include:
07
LIBRARIES
TYPES DESCRIPTION EXAMPLES
Represents numerical
Numeric 'int' , 'float' , 'complex'
values
Represents a collection of
In Python, data types are categories of Mapping
key-value pairs
'dict'
values that determine how the values
behave and what operations can be
Represents a collection of
performed on them. Here are some Set
unique elements
'set' , 'frozenset'
'bytes' , 'bytearray' ,
Binary Represents binary data
'memoryview'
Examples that shows how different data types can be used in
Python:
In Python, we’ll try to create a variable called "age" and
assign a value to it, like this:
Variables: Now, whenever you need to use that age value in your
Party Time! Get program, you can just use the variable name "age". For
example:
Operators: Arithmetic
Operators
Used to perform arithmetic
operations
'2 + 3' returns '5'
Calculations!
Logical Used to combine and 'True and False' returns
In Python, operators are symbols or Operators manipulate boolean values 'False'
Used to check if a
Membership
value is present in a '2 in [1, 2, 3]' return 'True'
Operators sequence
TYPES DESCRIPTION EXAMPLES
Conditional
Statements: If
statement
Executes a block
of code if a condition
is true
'x=5' <br>
'if x>3:'<br>
'print("x is greater than 3")'
code!
Executes one block
'if x>3: '<br>
If else of code if a condition
'print("x is greater than 3")' <br>
statement is true and another
'else:' <br>
block if it is false
Conditional statements in allow you to control 'print("x is less than or equal to 3")'
Functions: Built-in
functions
Functions that are built in python and can be
used without needing to define them.
Examples - 'print()' , 'len()' and 'range()'
The Superheroes Functions that you create yourself to perform
User-defined
of Code!
a specific task. They can be reused multiple
functions times throughout your code.