0% found this document useful (0 votes)
26 views3 pages

Python Basics Beginner Guide

The document provides an introduction to Python basics for beginners, covering essential rules such as indentation, variables, comments, input, and output functions. It includes examples of basic Python programs, such as a Hello World program, a simple calculator, and a number guessing game. Additionally, it outlines a 30-day learning roadmap for mastering Python, from installation to creating mini projects.

Uploaded by

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

Python Basics Beginner Guide

The document provides an introduction to Python basics for beginners, covering essential rules such as indentation, variables, comments, input, and output functions. It includes examples of basic Python programs, such as a Hello World program, a simple calculator, and a number guessing game. Additionally, it outlines a 30-day learning roadmap for mastering Python, from installation to creating mini projects.

Uploaded by

junaidzafar152
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Basics for Beginners

1. Basic Rules of Python


Indentation: Python mein spaces (indentation) bohat important hoti hain. Galat spacing
error de sakti hai.

Variables: Variables data store karne ke liye use hotay hain. Example: name = 'Junaid'

Comments: Comment likhne ke liye # use hota hai. Python is line ko ignore karta hai.

Input: User se data lene ke liye input() function use hota hai.

Output: Screen par result dikhane ke liye print() function use hota hai.

2. Basic Python Programs

Program 1: Hello World


print("Hello World")

Program 2: Addition of Two Numbers


a=5
b=3
sum = a + b
print(sum)

Program 3: User Input Addition


a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print(a + b)

Program 4: Even or Odd Checker


num = int(input("Enter number: "))
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")

Program 5: Table Program


num = int(input("Enter number: "))
for i in range(1,11):
print(num * i)
Program 6: Simple Calculator
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))

print("Addition:", a + b)
print("Subtraction:", a - b)
print("Multiplication:", a * b)
print("Division:", a / b)

Program 7: Number Guessing Game


secret = 7
guess = int(input("Guess the number: "))

if guess == secret:
print("Correct!")
else:
print("Wrong guess")

Program 8: Password Check


password = input("Enter password: ")
if password == "1234":
print("Access Granted")
else:
print("Access Denied")

Program 9: Count 1 to 10
for i in range(1,11):
print(i)

Program 10: Square of Numbers


for i in range(1,11):
print(i, i*i)

3. 30 Day Python Learning Roadmap


Day 1-3: Python installation aur Hello World program.

Day 4-6: Variables aur data types seekho.

Day 7-10: Input aur output practice karo.

Day 11-15: If conditions aur logical operators.

Day 16-20: Loops (for aur while).


Day 21-24: Functions banana seekho.

Day 25-27: Lists aur basic data structures.

Day 28-29: Small projects jaise calculator aur guessing game.

Day 30: Apna mini project banao.

You might also like