[go: up one dir, main page]

0% found this document useful (0 votes)
8 views2 pages

Python Basics Summary

Uploaded by

sfynhm799
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Python Basics Summary

Uploaded by

sfynhm799
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Basics Summary

1. Variables & Data Types:


- int, float, str, bool, list, tuple, dict, set

2. Operators:
- Arithmetic: +, -, *, /, %, **, //
- Comparison: ==, !=, >, <, >=, <=
- Logical: and, or, not

3. Control Flow:
- if, elif, else
- for loops, while loops
- break, continue

4. Functions:
- def my_function(param):
- return value

5. Collections:
- List: ordered, mutable
- Tuple: ordered, immutable
- Set: unordered, unique values
- Dict: key-value pairs

6. Strings:
- "Hello".lower(), "Hello".upper(), "Hello".split(), " ".join(list)

7. Input & Output:


- input("Enter: ")
- print("Hello")

8. Modules:
- import math
- from random import randint

9. File Handling:
- f = open("file.txt", "r")
- f.read(), f.write()
- f.close()

10. Exceptions:
- try:
# code
except Exception as e:
# handle error

---
Quick Reference for Beginners.

You might also like