PythonLecture 01
PythonLecture 01
Python
print("Hello,World!")
Why Python is simple
Python is considered
simple for several
reasons:
• Readability: Python code is known for its readability, thanks to its use of clear
and concise syntax. It uses indentation to define code blocks, which makes the
code visually clear and easy to follow.
• Simplicity: Python has a relatively simple syntax with few keywords. This makes
it easier to learn and use compared to other programming languages.
• Large standard library: Python has a large standard library that includes a wide
variety of modules and functions for common tasks. This means that you don't
have to write a lot of code from scratch to get started.
Developed by whom
Python is portable because it is a high-level language. This means that Python code
can be run on any computer that has a Python interpreter installed, regardless of the
underlying operating system or hardware architecture. The Python interpreter translates
the Python code into machine code that the specific computer can understand.
The print function then outputs the string to the console. Details
The Python character set is a superset of the ASCII character set. It includes the
following characters:
• Letters (uppercase and lowercase)
• Digits (0-9)
• Special symbols (e.g., $, %, ^, &, *, (,), -, +, =, {,}, [])
• White spaces (e.g., space, tab, newline)
• Other characters (e.g., ©, ™, ®)
Variables
A variable is a named storage location in memory that can hold a value. You can
declare a variable in Python by assigning a value to it. The value can be of any data
type.
An identifier is a name given to a variable, function, class, or module. Here are the rules
for identifiers in Python:
• Integers (e.g., 1, 2, 3)
• Floating-point numbers (e.g., 3.14, 1.0e-5)
• Strings (e.g., "Hello, world!", 'This is a string')
• Booleans (True or False)
• Lists (ordered collections of items)
• Tuples (immutable ordered collections of items)
• Dictionaries (collections of key-value pairs)
Arithmetic Operators
Python supports the following arithmetic operators:
• Addition (+)
• Subtraction (-)
• Multiplication (*)
• Division (/)
• Floor division (//)
• Modulo (%)
• Exponentiation (**)
**Explanation:**
- `(C + D) * 2` evaluates to 10 (5 multiplied by 2).
- `10 * B` concatenates the string "@" ten times