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
Ad

More Related Content

What's hot (20)

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

More from IHTMINSTITUTE (19)

Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Creating Simple Functions
Python PCEP Creating Simple FunctionsPython PCEP Creating Simple Functions
Python PCEP Creating Simple Functions
IHTMINSTITUTE
 
Python PCEP Functions And Scopes
Python PCEP Functions And ScopesPython PCEP Functions And Scopes
Python PCEP Functions And Scopes
IHTMINSTITUTE
 
Python PCEP Function Parameters
Python PCEP Function ParametersPython PCEP Function Parameters
Python PCEP Function Parameters
IHTMINSTITUTE
 
Python PCEP Functions
Python PCEP FunctionsPython PCEP Functions
Python PCEP Functions
IHTMINSTITUTE
 
Python PCEP Multidemensional Arrays
Python PCEP Multidemensional ArraysPython PCEP Multidemensional Arrays
Python PCEP Multidemensional Arrays
IHTMINSTITUTE
 
Python PCEP Operations On Lists
Python PCEP Operations On ListsPython PCEP Operations On Lists
Python PCEP Operations On Lists
IHTMINSTITUTE
 
Python PCEP Sorting Simple Lists
Python PCEP Sorting Simple ListsPython PCEP Sorting Simple Lists
Python PCEP Sorting Simple Lists
IHTMINSTITUTE
 
Python PCEP Lists Collections of Data
Python PCEP Lists Collections of DataPython PCEP Lists Collections of Data
Python PCEP Lists Collections of Data
IHTMINSTITUTE
 
Python PCEP Logic Bit Operations
Python PCEP Logic Bit OperationsPython PCEP Logic Bit Operations
Python PCEP Logic Bit Operations
IHTMINSTITUTE
 
Python PCEP Loops
Python PCEP LoopsPython PCEP Loops
Python PCEP Loops
IHTMINSTITUTE
 
Python PCEP Comparison Operators And Conditional Execution
Python PCEP Comparison Operators And Conditional ExecutionPython PCEP Comparison Operators And Conditional Execution
Python PCEP Comparison Operators And Conditional Execution
IHTMINSTITUTE
 
Python PCEP How To Talk To Computer
Python PCEP How To Talk To ComputerPython PCEP How To Talk To Computer
Python PCEP How To Talk To Computer
IHTMINSTITUTE
 
Python PCEP Operators
Python PCEP OperatorsPython PCEP Operators
Python PCEP Operators
IHTMINSTITUTE
 
Python PCEP Literals
Python PCEP LiteralsPython PCEP Literals
Python PCEP Literals
IHTMINSTITUTE
 
IHTM Python PCEP Hello World
IHTM Python PCEP Hello WorldIHTM Python PCEP Hello World
IHTM Python PCEP Hello World
IHTMINSTITUTE
 
IHTM Python PCEP Introduction to Python
IHTM Python PCEP Introduction to PythonIHTM Python PCEP Introduction to Python
IHTM Python PCEP Introduction to Python
IHTMINSTITUTE
 
Python PCEP Welcome Opening
Python PCEP Welcome OpeningPython PCEP Welcome Opening
Python PCEP Welcome Opening
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Tuples and Dictionaries
Python PCEP Tuples and DictionariesPython PCEP Tuples and Dictionaries
Python PCEP Tuples and Dictionaries
IHTMINSTITUTE
 
Python PCEP Creating Simple Functions
Python PCEP Creating Simple FunctionsPython PCEP Creating Simple Functions
Python PCEP Creating Simple Functions
IHTMINSTITUTE
 
Python PCEP Functions And Scopes
Python PCEP Functions And ScopesPython PCEP Functions And Scopes
Python PCEP Functions And Scopes
IHTMINSTITUTE
 
Python PCEP Function Parameters
Python PCEP Function ParametersPython PCEP Function Parameters
Python PCEP Function Parameters
IHTMINSTITUTE
 
Python PCEP Functions
Python PCEP FunctionsPython PCEP Functions
Python PCEP Functions
IHTMINSTITUTE
 
Python PCEP Multidemensional Arrays
Python PCEP Multidemensional ArraysPython PCEP Multidemensional Arrays
Python PCEP Multidemensional Arrays
IHTMINSTITUTE
 
Python PCEP Operations On Lists
Python PCEP Operations On ListsPython PCEP Operations On Lists
Python PCEP Operations On Lists
IHTMINSTITUTE
 
Python PCEP Sorting Simple Lists
Python PCEP Sorting Simple ListsPython PCEP Sorting Simple Lists
Python PCEP Sorting Simple Lists
IHTMINSTITUTE
 
Python PCEP Lists Collections of Data
Python PCEP Lists Collections of DataPython PCEP Lists Collections of Data
Python PCEP Lists Collections of Data
IHTMINSTITUTE
 
Python PCEP Logic Bit Operations
Python PCEP Logic Bit OperationsPython PCEP Logic Bit Operations
Python PCEP Logic Bit Operations
IHTMINSTITUTE
 
Python PCEP Comparison Operators And Conditional Execution
Python PCEP Comparison Operators And Conditional ExecutionPython PCEP Comparison Operators And Conditional Execution
Python PCEP Comparison Operators And Conditional Execution
IHTMINSTITUTE
 
Python PCEP How To Talk To Computer
Python PCEP How To Talk To ComputerPython PCEP How To Talk To Computer
Python PCEP How To Talk To Computer
IHTMINSTITUTE
 
Python PCEP Operators
Python PCEP OperatorsPython PCEP Operators
Python PCEP Operators
IHTMINSTITUTE
 
Python PCEP Literals
Python PCEP LiteralsPython PCEP Literals
Python PCEP Literals
IHTMINSTITUTE
 
IHTM Python PCEP Hello World
IHTM Python PCEP Hello WorldIHTM Python PCEP Hello World
IHTM Python PCEP Hello World
IHTMINSTITUTE
 
IHTM Python PCEP Introduction to Python
IHTM Python PCEP Introduction to PythonIHTM Python PCEP Introduction to Python
IHTM Python PCEP Introduction to Python
IHTMINSTITUTE
 
Python PCEP Welcome Opening
Python PCEP Welcome OpeningPython PCEP Welcome Opening
Python PCEP Welcome Opening
IHTMINSTITUTE
 
Ad

Recently uploaded (20)

AG-FIRMA Ai Agent for Agriculture | RAG ..
AG-FIRMA Ai Agent for Agriculture  | RAG ..AG-FIRMA Ai Agent for Agriculture  | RAG ..
AG-FIRMA Ai Agent for Agriculture | RAG ..
Anass Nabil
 
Fractures In Chronic Kidney Disease Patients - Copy (3).pptx
Fractures In Chronic Kidney Disease Patients - Copy (3).pptxFractures In Chronic Kidney Disease Patients - Copy (3).pptx
Fractures In Chronic Kidney Disease Patients - Copy (3).pptx
ChaitanJaunky1
 
Application Layer Application Layer Application Layer
Application Layer Application Layer Application LayerApplication Layer Application Layer Application Layer
Application Layer Application Layer Application Layer
Tito208863
 
Slides: The World Game (s) Redesign: Eco Economic Epochs.pdf
Slides: The World Game (s) Redesign: Eco Economic Epochs.pdfSlides: The World Game (s) Redesign: Eco Economic Epochs.pdf
Slides: The World Game (s) Redesign: Eco Economic Epochs.pdf
Steven McGee
 
APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...
APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...
APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...
APNIC
 
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
Taqyea
 
What's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff HustonWhat's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff Huston
APNIC
 
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
Taqyea
 
英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程
英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程
英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程
Taqyea
 
Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...
Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...
Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...
ssuserc2b27b
 
23 Introduction to E-Commerce ( PDFDrive ) (1).pdf
23 Introduction to E-Commerce ( PDFDrive ) (1).pdf23 Introduction to E-Commerce ( PDFDrive ) (1).pdf
23 Introduction to E-Commerce ( PDFDrive ) (1).pdf
Nguyễn Minh
 
Paper: The World Game (s) Great Redesign.pdf
Paper: The World Game (s) Great Redesign.pdfPaper: The World Game (s) Great Redesign.pdf
Paper: The World Game (s) Great Redesign.pdf
Steven McGee
 
API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...
API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...
API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...
CartCoders
 
What is the difference b/w IPv4 and IPv6
What is the difference b/w IPv4 and IPv6What is the difference b/w IPv4 and IPv6
What is the difference b/w IPv4 and IPv6
nidhisingh691197
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
What Is a Phone Numbers List Database? Defining a Phone Numbers List Database
What Is a Phone Numbers List Database? Defining a Phone Numbers List DatabaseWhat Is a Phone Numbers List Database? Defining a Phone Numbers List Database
What Is a Phone Numbers List Database? Defining a Phone Numbers List Database
DataProvider1
 
How to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any DowntimeHow to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any Downtime
steve198109
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
emestica1
 
34 Advances in Mobile Commerce Technologies (2003).pdf
34 Advances in Mobile Commerce Technologies (2003).pdf34 Advances in Mobile Commerce Technologies (2003).pdf
34 Advances in Mobile Commerce Technologies (2003).pdf
Nguyễn Minh
 
AG-FIRMA Ai Agent for Agriculture | RAG ..
AG-FIRMA Ai Agent for Agriculture  | RAG ..AG-FIRMA Ai Agent for Agriculture  | RAG ..
AG-FIRMA Ai Agent for Agriculture | RAG ..
Anass Nabil
 
Fractures In Chronic Kidney Disease Patients - Copy (3).pptx
Fractures In Chronic Kidney Disease Patients - Copy (3).pptxFractures In Chronic Kidney Disease Patients - Copy (3).pptx
Fractures In Chronic Kidney Disease Patients - Copy (3).pptx
ChaitanJaunky1
 
Application Layer Application Layer Application Layer
Application Layer Application Layer Application LayerApplication Layer Application Layer Application Layer
Application Layer Application Layer Application Layer
Tito208863
 
Slides: The World Game (s) Redesign: Eco Economic Epochs.pdf
Slides: The World Game (s) Redesign: Eco Economic Epochs.pdfSlides: The World Game (s) Redesign: Eco Economic Epochs.pdf
Slides: The World Game (s) Redesign: Eco Economic Epochs.pdf
Steven McGee
 
APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...
APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...
APNIC Policy Update and Participation, presented at TWNIC 43rd IP Open Policy...
APNIC
 
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
Taqyea
 
What's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff HustonWhat's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff Huston
APNIC
 
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
Taqyea
 
英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程
英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程
英国伯明翰城市大学毕业证书文凭定制BCU成绩单购买流程
Taqyea
 
Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...
Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...
Pink and Yellow Neon Modern Grid Playful Geometric Pattern Trivia Quiz Presen...
ssuserc2b27b
 
23 Introduction to E-Commerce ( PDFDrive ) (1).pdf
23 Introduction to E-Commerce ( PDFDrive ) (1).pdf23 Introduction to E-Commerce ( PDFDrive ) (1).pdf
23 Introduction to E-Commerce ( PDFDrive ) (1).pdf
Nguyễn Minh
 
Paper: The World Game (s) Great Redesign.pdf
Paper: The World Game (s) Great Redesign.pdfPaper: The World Game (s) Great Redesign.pdf
Paper: The World Game (s) Great Redesign.pdf
Steven McGee
 
API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...
API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...
API-First Approach To Shopify Salesforce Integration_ Why Developers Prefer I...
CartCoders
 
What is the difference b/w IPv4 and IPv6
What is the difference b/w IPv4 and IPv6What is the difference b/w IPv4 and IPv6
What is the difference b/w IPv4 and IPv6
nidhisingh691197
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
What Is a Phone Numbers List Database? Defining a Phone Numbers List Database
What Is a Phone Numbers List Database? Defining a Phone Numbers List DatabaseWhat Is a Phone Numbers List Database? Defining a Phone Numbers List Database
What Is a Phone Numbers List Database? Defining a Phone Numbers List Database
DataProvider1
 
How to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any DowntimeHow to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any Downtime
steve198109
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
emestica1
 
34 Advances in Mobile Commerce Technologies (2003).pdf
34 Advances in Mobile Commerce Technologies (2003).pdf34 Advances in Mobile Commerce Technologies (2003).pdf
34 Advances in Mobile Commerce Technologies (2003).pdf
Nguyễn Minh
 
Ad

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