Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Python_Learning_Guide

This guide provides an overview of Python, a versatile programming language used in various fields. It covers installation, basic syntax, core concepts like data types and functions, as well as advanced topics such as object-oriented programming and file handling. The guide emphasizes Python's beginner-friendly nature and encourages practice for mastery.

Uploaded by

realfake4731
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python_Learning_Guide

This guide provides an overview of Python, a versatile programming language used in various fields. It covers installation, basic syntax, core concepts like data types and functions, as well as advanced topics such as object-oriented programming and file handling. The guide emphasizes Python's beginner-friendly nature and encourages practice for mastery.

Uploaded by

realfake4731
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Language Learning Guide

Python is a popular, high-level programming language known for its simplicity and versatility. It is
widely used in web development, data science, AI, automation, and more.

# Installing Python:
1. Download Python from https://www.python.org/
2. Install it and ensure 'pip' (package manager) is installed.
3. Check installation using: python --version

# Basic Syntax:
- Print statement: print("Hello, World!")
- Variables: x = 10, name = "Anurag"
- Comments: # This is a comment

Python uses indentation instead of curly braces to define blocks.


Core Python Concepts

# Data Types:
- int, float, str, list, tuple, dict, set, bool

# Operators:
- Arithmetic: +, -, *, /, %
- Comparison: ==, !=, >, <, >=, <=

# Loops:
for i in range(5):
print(i) # Prints 0 to 4

while condition:
# Loop until condition is False

# Functions:
def greet(name):
return "Hello, " + name

print(greet("Anurag"))
Advanced Python Topics

# Object-Oriented Programming (OOP):


class Person:
def __init__(self, name, age):
self.name = name
self.age = age

def introduce(self):
return f"My name is {self.name}, and I am {self.age} years old."

p1 = Person("Anurag", 22)
print(p1.introduce())

# File Handling:
with open("file.txt", "w") as f:
f.write("Hello, Python!")

# Libraries:
import math
print(math.sqrt(16)) # Output: 4.0

Python is powerful and beginner-friendly. Keep practicing to master it!

You might also like