Ways to Format Strings When Printing in Python
Ways to Format Strings When Printing in Python
name = "Alice"
age = 25
2. Using str.format()
name = "Alice"
age = 25
name = "Alice"
age = 25
name = "Alice"
age = 25
Variables are used to store data that can be used and manipulated throughout the program. In
Python, you don't need to declare a variable with its data type—Python figures it out at runtime.
x = 10 # integer
1. Can contain letters (a-z, A-Z), digits (0–9), and underscores (_).
o name, _value, a1
o 1value, @name
4. Should not use Python keywords as variable names (e.g., if, for, while, class, etc.).