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

Python Basics for Beginners Guide

Uploaded by

953623243010
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)
4 views2 pages

Python Basics for Beginners Guide

Uploaded by

953623243010
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

■ Python Basics - Beginner Notes

1. What is Python?
- Python is a programming language used to create software, AI, websites, games, etc.
- Easy to read and write.

2. Why Python is Popular?


- Easy to learn, Free & Open-source, Works on all devices, Many libraries.

3. Variables
name = "Anusrii"
age = 20

4. Data Types
- String: "Hello"
- Integer: 10
- Float: 3.14
- Boolean: True

5. Print & Input


print("Hello")
name = input("Enter name: ")

6. If-Else
if age >= 18:
print("Adult")
else:
print("Minor")

7. Loops
for i in range(5):
print(i)

8. Lists
fruits = ["apple", "banana"]
[Link]("mango")

9. Functions
def greet(name):
print("Hello", name)

10. Dictionary
student = {"name": "Anusrii", "age": 20}
print(student["name"])

11. Tuples
numbers = (1, 2, 3)

12. Sets
nums = {1, 2, 3}

13. String Operations


[Link](), [Link](), len(name)

14. Slicing
word = "Python"
print(word[0:3])

15. Math Module


import math
[Link](16), [Link]

16. Try-Except
try:
num = int(input("Enter: "))
except:
print("Error")

17. File Handling


file = open("[Link]", "w")
[Link]("Hello")
[Link]()

18. Classes
class Student:
def __init__(self, name):
[Link] = name

You might also like