Python Lecture 1
Python Lecture 1
• Letters – A to Z, a to z
• Digits – 0 to 9
• Special Symbols - + - * / etc.
• Whitespaces – Blank Space, tab, carriage return, newline, form feed
• Other characters – Python can process all ASCII and Unicode
characters as part of data or literals
Variable
A variable is a name given to a memory location in a program.
• name = “Rahim"
• age = 23
• price = 25.99
Memory
• name = “Rahim"
• age = 23
• price = 25.99
Rules for Identifiers
1.Allowed Characters:
•Identifiers can only contain letters (A-Z or a-z), digits (0-9), and underscores (_).
2.Cannot Start with a Digit:
•An identifier cannot begin with a digit. For example, 123name is invalid, but name123 is valid.
3.Case Sensitivity:
•Identifiers are case-sensitive. For instance, variable, Variable, and VARIABLE are three different
identifiers.
4.No Reserved Words:
•Python keywords (like if, else, for, while, class, def, etc.) cannot be used as identifiers. You can find the
complete list of keywords by using:
Going on…
• Arithmetic Operators ( + , - , * , / , % , ** )
• Relational / Comparison Operators ( == , != , > , < , >= , <= )
• Assignment Operators ( = , +=, -= , *= , /= , %= , **= )
• Logical Operators ( not , and , or )
Input in Python
input( ) statement is used to accept values (using keyboard) from user