Print Command, Comments & Data Types
1. Print Command
print()is used to display output
Example:
print("Hello World")
2. Comments in Python
- Comments explain code
- Python ignores comments
- Written using #
Example:
# This is a comment
3. Data Types
A data type tells Python what kind of data is used.
String
- Text inside quotes
Example:
print("Python is fun")
Integer
- Whole numbers
- We don’t use quotation marks for integers unlike strings.
Example:
print(10)
Float
- Decimal numbers
- We don’t use quotation marks for floats, unlike strings.
Example:
print(3.5)
Boolean
- True or False
Example:
print(True)
4. Pyramid Printing Activity
- Each
print()creates a new line - Stars can form shapes
Example:
*
**
***
5. Task
- Print all 4 data types
- Print any shape using stars