SlideShare a Scribd company logo
Module 1
operations, basic operators,data types, variables,
basic input-output
Variables
Module 1 Variables
What are variables?
Variable name
be composed of
uppercase or
lowercase letters,
digits, and the
character _
begin with a letter;
the underscore
character is a letter;
upper- and lower-
case letters are
treated as different;
not be any of
Python's reserved
words.
Module 1 Variables
Correct & incorrect variable names
Correct, but not always
convenient:
Incorrect
MyVariable i t34 Exchange_Rate
days_to_christmas TheNameIsSoLongThatYouWillMakeMistakesWithIt
10t Exchange Rate
Module 1 Variables
Keywords
neither
for your
variables
nor
functions
Keyword
s
'False', 'None', 'True', 'and', 'as',
'assert', 'break', 'class', 'continue', 'def',
'del', 'elif', 'else', 'except', 'finally', 'for',
'from', 'global', 'if', 'import', 'in', 'is',
'lambda', 'nonlocal', 'not', 'or', 'pass',
'raise', 'return', 'try', 'while', 'with',
'yield'
Module 1 Variables
Creating variables
use the
name of
the
desired
variable
the equal
sign (=)
the value
var = 1
account_balance = 1000.0
client_name = 'John Doe'
print(var, account_balance, client_name)
print(var)
1 1000.0 John Doe
1
Module 1 Variables
Assigning a new value to an already existing
variable
var = 1
print(var)
var = var + 1
print(var)
1
2
var = 100
var = 200 + 300
print(var)
500
a = 3.0
b = 4.0
c = (a ** 2 + b ** 2) ** 0.5
print("c =", c)
c = 5.0
Module 1 Variables
Shortcut operators
x *= 2
• x = x * 2
sheep += 1
• sheep = sheep + 1
variable op= expression
• variable = variable op expression
Module 1 Variables
Key takeaways
1
• A variable is a named location reserved to store values in the memory
2
• Each variable must have a unique name - an identifier
3
• Python is a dynamically-typed language
4
• Using compound assignment operators
5
• Assigning new values to already existing variables
6
• Combining text and variables using the + operator
Module 1 Variables
LAB Practice
4. Variables
5. Variables: a simple converter
6. Operators and expressions

More Related Content

What's hot (20)

PDF
JetBrains MPS: Editor Aspect
Mikhail Barash
 
PPT
PL/SQL Example for IF .. ELSIF
Kai Liu
 
PPTX
What is identifier c programming
Rumman Ansari
 
PPTX
Presentation on C Switch Case Statements
Dipesh Panday
 
PPTX
Switch case in C++
Barani Govindarajan
 
PDF
JetBrains MPS: Typesystem Aspect
Mikhail Barash
 
PPTX
All about decision making statements in php
Programing Code Example
 
PPTX
Decision structures
Glenda Finley
 
PDF
Applied Calculus: An Introduction to Derivatives
baetulilm
 
PPTX
Password Strength
Naveenchandra Halemani
 
PPTX
Java Datatypes
Mayank Aggarwal
 
PPT
Variables in C Programming
programming9
 
PPTX
Nondeterministic finite automaton
Dr. ABHISHEK K PANDEY
 
PPT
Codings Standards
Philip Johnson
 
PPT
decisions
Rajendran
 
PDF
Lecture 4 constants_variables
eShikshak
 
PDF
Best coding practices to follow - to write a code, like a boss
Avil Porwal
 
PPT
Escape Sequences and Variables
yarkhosh
 
PPTX
Control statement-Selective
Nurul Zakiah Zamri Tan
 
PDF
R decision making
Learnbay Datascience
 
JetBrains MPS: Editor Aspect
Mikhail Barash
 
PL/SQL Example for IF .. ELSIF
Kai Liu
 
What is identifier c programming
Rumman Ansari
 
Presentation on C Switch Case Statements
Dipesh Panday
 
Switch case in C++
Barani Govindarajan
 
JetBrains MPS: Typesystem Aspect
Mikhail Barash
 
All about decision making statements in php
Programing Code Example
 
Decision structures
Glenda Finley
 
Applied Calculus: An Introduction to Derivatives
baetulilm
 
Password Strength
Naveenchandra Halemani
 
Java Datatypes
Mayank Aggarwal
 
Variables in C Programming
programming9
 
Nondeterministic finite automaton
Dr. ABHISHEK K PANDEY
 
Codings Standards
Philip Johnson
 
decisions
Rajendran
 
Lecture 4 constants_variables
eShikshak
 
Best coding practices to follow - to write a code, like a boss
Avil Porwal
 
Escape Sequences and Variables
yarkhosh
 
Control statement-Selective
Nurul Zakiah Zamri Tan
 
R decision making
Learnbay Datascience
 

Similar to Python PCEP Variables (20)

PPTX
Python Lecture 2
Inzamam Baig
 
PDF
PPE-Module-1.2 PPE-Module-1.2 PPE-Module-1.2.pdf
ArjayBalberan1
 
PPTX
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
Rushikesh Kolhe
 
PDF
Python unit 1 part-2
Vikram Nandini
 
PDF
TOPIC-2-Expression Variable Assignment Statement.pdf
EjazAlam23
 
PPTX
Intro to CS Lec03 (1).pptx
FamiDan
 
PPTX
PART 1 - Python Tutorial | Variables and Data Types in Python
Shivam Mitra
 
PDF
Lecture 4 variables data types and operators
alvin567
 
PPTX
PPT_1_9102501a-a7a1-493e-818f-cf699918bbf6.pptx
myatminsoe180
 
PPTX
Pythonlearn-02-Expressions123AdvanceLevel.pptx
AninditaSarkarNaha
 
PDF
03-Variables, Expressions and Statements (1).pdf
MirHazarKhan1
 
PPT
17575602.ppt
TejaValmiki
 
PPTX
Python variable assignments | JNTUA | R19 | UNIT 1
FabMinds
 
PPTX
1.4 Work with data types and variables, numeric data, string data.pptx
VGaneshKarthikeyan
 
PPTX
Lec2_cont.pptx galgotias University questions
YashJain47002
 
PDF
Python Fundamentals Class 11
chinthala Vijaya Kumar
 
PPT
Gaddis Python 3e Chapter 02 PPT (1).ppt
Farahali78
 
PDF
python2oxhvoudhuSGFsughusgdogusuosFU.pdf
rohithzach
 
PPT
PythonCourse_02_Expressions.ppt Python introduction turorial for beginner.
sakchaisengsui
 
PDF
Variables in Python & Data Types and Their Values
Raza Ul Mustafa
 
Python Lecture 2
Inzamam Baig
 
PPE-Module-1.2 PPE-Module-1.2 PPE-Module-1.2.pdf
ArjayBalberan1
 
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
Rushikesh Kolhe
 
Python unit 1 part-2
Vikram Nandini
 
TOPIC-2-Expression Variable Assignment Statement.pdf
EjazAlam23
 
Intro to CS Lec03 (1).pptx
FamiDan
 
PART 1 - Python Tutorial | Variables and Data Types in Python
Shivam Mitra
 
Lecture 4 variables data types and operators
alvin567
 
PPT_1_9102501a-a7a1-493e-818f-cf699918bbf6.pptx
myatminsoe180
 
Pythonlearn-02-Expressions123AdvanceLevel.pptx
AninditaSarkarNaha
 
03-Variables, Expressions and Statements (1).pdf
MirHazarKhan1
 
17575602.ppt
TejaValmiki
 
Python variable assignments | JNTUA | R19 | UNIT 1
FabMinds
 
1.4 Work with data types and variables, numeric data, string data.pptx
VGaneshKarthikeyan
 
Lec2_cont.pptx galgotias University questions
YashJain47002
 
Python Fundamentals Class 11
chinthala Vijaya Kumar
 
Gaddis Python 3e Chapter 02 PPT (1).ppt
Farahali78
 
python2oxhvoudhuSGFsughusgdogusuosFU.pdf
rohithzach
 
PythonCourse_02_Expressions.ppt Python introduction turorial for beginner.
sakchaisengsui
 
Variables in Python & Data Types and Their Values
Raza Ul Mustafa
 
Ad

More from IHTMINSTITUTE (19)

PPTX
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
PPTX
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
PPTX
Python PCEP Creating Simple Functions
IHTMINSTITUTE
 
PPTX
Python PCEP Functions And Scopes
IHTMINSTITUTE
 
PPTX
Python PCEP Function Parameters
IHTMINSTITUTE
 
PPTX
Python PCEP Functions
IHTMINSTITUTE
 
PPTX
Python PCEP Multidemensional Arrays
IHTMINSTITUTE
 
PPTX
Python PCEP Operations On Lists
IHTMINSTITUTE
 
PPTX
Python PCEP Sorting Simple Lists
IHTMINSTITUTE
 
PPTX
Python PCEP Lists Collections of Data
IHTMINSTITUTE
 
PPTX
Python PCEP Logic Bit Operations
IHTMINSTITUTE
 
PPTX
Python PCEP Loops
IHTMINSTITUTE
 
PPTX
Python PCEP Comparison Operators And Conditional Execution
IHTMINSTITUTE
 
PPTX
Python PCEP How To Talk To Computer
IHTMINSTITUTE
 
PPTX
Python PCEP Operators
IHTMINSTITUTE
 
PPTX
Python PCEP Literals
IHTMINSTITUTE
 
PPTX
IHTM Python PCEP Hello World
IHTMINSTITUTE
 
PPTX
IHTM Python PCEP Introduction to Python
IHTMINSTITUTE
 
PPTX
Python PCEP Welcome Opening
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Creating Simple Functions
IHTMINSTITUTE
 
Python PCEP Functions And Scopes
IHTMINSTITUTE
 
Python PCEP Function Parameters
IHTMINSTITUTE
 
Python PCEP Functions
IHTMINSTITUTE
 
Python PCEP Multidemensional Arrays
IHTMINSTITUTE
 
Python PCEP Operations On Lists
IHTMINSTITUTE
 
Python PCEP Sorting Simple Lists
IHTMINSTITUTE
 
Python PCEP Lists Collections of Data
IHTMINSTITUTE
 
Python PCEP Logic Bit Operations
IHTMINSTITUTE
 
Python PCEP Loops
IHTMINSTITUTE
 
Python PCEP Comparison Operators And Conditional Execution
IHTMINSTITUTE
 
Python PCEP How To Talk To Computer
IHTMINSTITUTE
 
Python PCEP Operators
IHTMINSTITUTE
 
Python PCEP Literals
IHTMINSTITUTE
 
IHTM Python PCEP Hello World
IHTMINSTITUTE
 
IHTM Python PCEP Introduction to Python
IHTMINSTITUTE
 
Python PCEP Welcome Opening
IHTMINSTITUTE
 
Ad

Recently uploaded (20)

PDF
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PDF
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PDF
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
PPTX
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
PDF
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
PPTX
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
PDF
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
Orchestrating things in Angular application
Peter Abraham
 
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 

Python PCEP Variables

  • 1. Module 1 operations, basic operators,data types, variables, basic input-output Variables
  • 2. Module 1 Variables What are variables? Variable name be composed of uppercase or lowercase letters, digits, and the character _ begin with a letter; the underscore character is a letter; upper- and lower- case letters are treated as different; not be any of Python's reserved words.
  • 3. Module 1 Variables Correct & incorrect variable names Correct, but not always convenient: Incorrect MyVariable i t34 Exchange_Rate days_to_christmas TheNameIsSoLongThatYouWillMakeMistakesWithIt 10t Exchange Rate
  • 4. Module 1 Variables Keywords neither for your variables nor functions Keyword s 'False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield'
  • 5. Module 1 Variables Creating variables use the name of the desired variable the equal sign (=) the value var = 1 account_balance = 1000.0 client_name = 'John Doe' print(var, account_balance, client_name) print(var) 1 1000.0 John Doe 1
  • 6. Module 1 Variables Assigning a new value to an already existing variable var = 1 print(var) var = var + 1 print(var) 1 2 var = 100 var = 200 + 300 print(var) 500 a = 3.0 b = 4.0 c = (a ** 2 + b ** 2) ** 0.5 print("c =", c) c = 5.0
  • 7. Module 1 Variables Shortcut operators x *= 2 • x = x * 2 sheep += 1 • sheep = sheep + 1 variable op= expression • variable = variable op expression
  • 8. Module 1 Variables Key takeaways 1 • A variable is a named location reserved to store values in the memory 2 • Each variable must have a unique name - an identifier 3 • Python is a dynamically-typed language 4 • Using compound assignment operators 5 • Assigning new values to already existing variables 6 • Combining text and variables using the + operator
  • 9. Module 1 Variables LAB Practice 4. Variables 5. Variables: a simple converter 6. Operators and expressions