Introduction To Python
Introduction To Python
T O O U R P R E S E N T A T I O N
E
PRESENTATION NO.10
Group members: Laiba
Maryam
Hamma
d
Abdul
Mana
n
Minahil
Salman
fatima
Ahmad
raza
INTRODUCTION
Presentation No .10
Topics:
• Introduction to python
• Operators , operation & comparisons
• Problem solving , repetition structure and pseudo codes
COMPUTER PROGRAM
such as:
• Performing calculations: From simple arithmetic to complex
mathematical equations.
Definition:
A Python program is a sequence of instructions written in the Python
programming language that tells a computer what to do. Python is a
versatile, high-level programming language known for its simplicity
and readability. It's widely used for various applications, from web
development and data science to artificial intelligence and
automation.
PYTHON
• Versatility: Python can be used for a wide range of applications, including web
development, data science, machine learning, and automation.
• Standard library: Python comes with a rich standard library that provides
modules for various tasks, such as file I/O, network programming, and data
manipulation.
INDENTATION
Purposes:
• Improves readability.
• Helps in indicating a block of code.
Example:
char name = "Sam";
if (name == "Sam")
{ printf("Hello Sam!");}
C program
name = ‘Sam’ if name == 'Sam': print('Hello Sam’)
This highlights the use of indentation in Python to define code blocks. Unlike C,
which uses curly braces {} to group statements, Python relies on consistent
spacing (usually 4 spaces) to indicate the beginning and end of a code block.
This makes Python code more visually appealing and easier to understand.
WORKING OF INDENTATION
WITHOUT INDENTATION: WITH INDENTATION:
• 2.if...else statement :
• 1.if statement :
age = int(input("enter your age"))
age = int(input("enter your
age")) if age > 18:
Types of Operators:
Arithmetic Operators: +, -, , /,
Relational/Comparison Operators: ==, !=, >, <, >=, <=.
Assignment Operators: =, +=, -=, *=, /=, etc.
Logical operators: And ,Or & Not(&&, ||, !).
VARIABLE COMPARISON
• Purpose : Used to compare two values or variables
• Definition:
• Example 1:
Basic calculation with precedence:- 3 + 5 * 2 evaluates to 13
(multiplication before addition).
• Practical Applications: Decision-making in applications, data
validation, control flow.
EXAMPLES AND CODE DEMONSTRATIONS
4. Choose a Solution:
Pick the best solution and make a plan to implement it.
5. Take Action:
Put your plan into action.
6. Evaluate the Results:
Did your solution work? If not, what can you do differently next time?
PYTHON WITH DECISION MAKING
Steps
1.Input
2.Repetition
3.Output
PSEUDOCODE
It is an informal way to describe an algorithm using plane
language. It helps you without syntax.
Example:
Input Number 1
Input Number 2
Input Number 3
If Number 1 >= Number 2 and Number 1 >= Number 3
Print "Largest number 1"
Else if Number 2 >= Number 1 and Number 2 >= Number 3
Print "Largest number 2" Else
Print "Largest number 3"
FLOWCHART
Start
Input no 1 If
No 1 > 3 Yes Print
Input no 2
And “Larger is
Input no 3
No 1 > 3 no 1”
No
If
Print Yes No 2 > 1 No Print
“Larger is And “Larger no End
no 2” No 2 > 3 is 3”