0% found this document useful (0 votes)
36 views5 pages

Python Programming Basics for Beginners

The document provides an introduction to Python, a programming language used for various applications such as games and websites. It covers basic concepts including data types, variables, and control structures like loops and conditionals. Additionally, it offers examples of syntax for input, output, and comments in Python code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views5 pages

Python Programming Basics for Beginners

The document provides an introduction to Python, a programming language used for various applications such as games and websites. It covers basic concepts including data types, variables, and control structures like loops and conditionals. Additionally, it offers examples of syntax for input, output, and comments in Python code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to

Python
What is python?

A computing language that is used to write all sorts of programs such as games, websites, software,
automated tasks etc.

To start

download python from [Link]

Newest version – 3.12

- When an algorithm is created to run it and get the solution you can use programming
languages. For IGCSE it is python
- When programs are written they are written in high level programming language , meaning it
can be understood by humans

DATATYPES

- It doesn’t have data types of characters

INTEGER int Whole numbers Age=20

Real or float float Numbers with decimals Weight=23.3433


Boolean bool True or false values LightOn=True
Character Doesn’t have A number, letter , symbol M
or even a space
String Str A set of character Type=”solid”

MOD AND DIV

IN DIFFERENT SCENARIOS WE REPRESENT MOD AND DIV DIFFERENTLY.

IN ALGORITHMS IN PYTHON
MOD AND DIV ITSELF MOD = %
DIV -//
EG – 30MOD4 EG – 30%4
Unique names given
to a variable is an
Variables identifier !!!!

• They are containers/identifier to store data


• It is considered as a memory location
• Either way there are certain rules you must
follow :)
- Should be a single word
- Cannot use spaces but to separate an
underscore can be used
- They can be changed while being run and
can be overwritten meaning it can be given
new values every time you run
- The number will initially be 0 when began.

Keyword chart

TO INPUT Variable=datatype(input (“message ”))


To output Print(“message”)
Assigning a Total=0
value
selection If condition:
statement
Else:
Statement
Eg:
If val==0:
print(“hi”)
else
print (“bye”)
Nested if If condition:
statement
Elif condition:
Statement
Else:
Statement
Iteration for variable in range(start,end)
While while condition
statement
Constant Doesn’t have keywords
variable
- A constant variable is a fixed variable that
doesn’t change
- To give comments on what you write in
the code you use the hashtag # which has a
colour of red
Iteration in python !
Tot=0
for count in range(1,11):
num=input(“enter num”)
Tot=Tot+num
output(tot)

You might also like