0% found this document useful (0 votes)
5 views13 pages

Week 1 Day 2 Presentation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views13 pages

Week 1 Day 2 Presentation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

BASIC PYTHON SYNTAX

AND DATA TYPES


Variables, Data Types, Comments, Operators, Input and
Output
DATA TYPES IN PYTHON
PRIMITIVE DATA TYPES

01 02
NUMBERS 1, 2.00 STRINGS “ABCD?@”
[Integers (Int), Floating [Sequence of characters]
Point(Float) and Complex
Numbers]

03
Boolean
[True, False]
NON-PRIMITIVE DATA TYPES
ALSO KNOWN AS DATA STRUCTURES

1. Lists (arrays) []
2. Tuples (immutable lists) ()
3. Dictionaries (hash tables) {}
4. Sets (unordered collections) {}
MUTABLE / IMMUTABLE

A mutable data type is one that can be modified or


changed after it's created. In other words, its state can
be altered, and the changes will be reflected in the
original object.

1. Lists
2. Dictionaries
3. Sets
MUTABLE / IMMUTABLE

Immutable data types cannot be changed once they're


created. If you try to modify an immutable object, a new
object is created, and the original remains unchanged.

1. Integers
2. Floats
3. Strings
4. Tuples
5. Boolean values
6. Frozen sets
The type() function can be used to check the
type of an object in python
CASTING
Casting is the process of converting an object of one data type into
another.
Casting is useful when you need to:

Convert data types for compatibility or consistency


Perform specific operations or calculations
Ensure data is in the correct format for a particular function or method-
Handle different data types in a flexible way
INPUT / OUTPUT
The input() function can be used to get user
input
INPUT / OUTPUT
The print() function can be used to output
data in the terminal
VARIABLES
A Variable is a container for storing data

X = 23
Print(x)
COMMENT
S
Comments are lines of code that are ignored by the interpreter but
are useful for humans to understand the code.
OPERATORS
Arithmetic Operators
+ - * / // % **

Comparison Operators
== (Equal to), != (Not equal to), > (Greater than), < (Less than) >=
(Greater than or equal to), <= (Less than)

Assignment Operators
= (Assignment), += (Addition assignment), -= (Subtraction assignment) *=
(Multiplication assignment), /= (Division assignment) **=
(Exponentiation assignment), %= (Modulus assignment), //=
(Floor Division assignment)
THANKS FOR
LISTENING!

You might also like