Python Introduction Notes
Python Introduction Notes
L.Obj:
Students will be able to use input/output functions, variables, and basic
data types in Python programs.
Input and Output
input()
• Used to receive information from the user.
• By default, input() always returns a string value.
Syntax:
variable = input("message")
Example:
name = input("Enter your name-")
Age=int(input("Enter your age-"))
print()
• Used to display information to the user.
Syntax:
print(“string”)
Examples:
print("Welcome to Python!")
print(5 + 3)
Variables
• A variable is a container to store values.
• It Uses = sign to assign a value to a variable.
• Syntax:
variable_name = value
Example:
city = "Abu Dhabi"
Variable Naming Rules
• Can include letters, digits, underscore (_)
• Cannot start with a digit
• Case-sensitive (Name ≠ name)
• No special characters like @, $, %
• Avoid reserved words
Data Types
Different kinds of values you can store in variables.
• Integer: Whole numbers (e.g., 10, -5)
• Float: Numbers with decimals (e.g., 3.14, -2.0)
• String: Text in quotes (e.g., "Hello", '123')
• Boolean: Only True or False
Examples:
name = "ADIS" (String)
age = 15 (Integer)
radius = 2.5 (Float)
status = True (Boolean)
Comments
• Single-line: starts with #
Example: # This is a comment
• Multi-line: use triple quotes