#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Python Sample Code for Beginners: 15 आसान Python Programs (हिंदी में)

संक्षिप्त जवाब: Python सीखने का सबसे तेज तरीका है छोटे-छोटे programs खुद लिखकर run करना। Beginners को Hello World, दो numbers का sum, even-odd, leap year, factorial और multiplication table जैसे programs से शुरू करना चाहिए। इनसे syntax, input/output, conditions और loops, चारों basics एक साथ पक्के हो जाते हैं। इस blog में ऐसे 15 programs output और explanation के साथ दिए गए हैं।

Python दुनिया की सबसे popular और beginner-friendly programming languages में से एक है। इसकी syntax लगभग English जैसी पढ़ने में आसान है, इसलिए नए learners इसे जल्दी पकड़ लेते हैं। लेकिन सिर्फ theory पढ़ने से programming नहीं आती। असली सीख तब होती है जब आप छोटे programs खुद type करके run करते हैं।

लेखक: Ms. Sonal · Category: Python Programming · पढ़ने का समय: 13 मिनट

Total programs
15
Basic programs (output के साथ)
10
Extra practice programs
5
Basics सीखने का समय
1–2 महीने

इस लेख में आप सीखेंगे

क्यों?Beginners को simple programs से शुरुआत क्यों करनी चाहिए
10 Basics10 basic Python programs (output के साथ)
5 Extra5 extra practice programs
TipsPython सीखने के tips, applications और project ideas

साथ ही: Python से जुड़े common FAQs।

Simple Python Programs से शुरुआत क्यों करें?

छोटे programs लिखने से आप एक साथ कई जरूरी चीजें सीखते हैं:

  • Syntax और Indentation: Python में indentation (space) से code blocks बनते हैं, यह आदत शुरू में ही पक्की होती है।
  • Loops और Conditions: for, while, if-else का practical use समझ आता है।
  • Functions: Code को reusable बनाने की सोच विकसित होती है।
  • Input और Output: User से data लेना और result दिखाना सीखते हैं।
  • Debugging: Errors पढ़ना और उन्हें ठीक करना आता है।

Beginners के लिए 10 Simple Python Programs

1Greeting Print करना (Hello World)

print("Hello, World!") print("Python सीखने में आपका स्वागत है")

Output:

Hello, World! Python सीखने में आपका स्वागत है

Explanation: print() function screen पर text दिखाता है। Text को हमेशा quotes (" ") में लिखा जाता है। यह हर language का पहला program होता है।

2दो Numbers का Sum

a = 10 b = 20 total = a + b print("Sum:", total)

Output:

Sum: 30

Explanation: a और b variables में values रखी गई, + operator से जोड़ा गया और result total में store हुआ। Python में variable का type बताना नहीं पड़ता।

3User से Input लेना

name = input("आपका नाम क्या है? ") print("Hello,", name)

Output:

आपका नाम क्या है? Rahul Hello, Rahul

Explanation: input() user से keyboard input लेता है और उसे हमेशा string (text) के रूप में return करता है।

4किसी Number का Square निकालना

num = int(input("Enter a number: ")) square = num ** 2 print("Square of", num, "is", square)

Output:

Enter a number: 7 Square of 7 is 49

Explanation: int() input string को integer में बदलता है। ** power operator है, यानी num ** 2 का मतलब num².

5Even या Odd Check करना

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

Output:

Enter a number: 15 15 is Odd

Explanation: % (modulus) remainder देता है। अगर number को 2 से भाग देने पर remainder 0 है, तो number even है, वरना odd।

6दो Numbers में बड़ा Number ढूँढना

a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) if a > b: print(a, "is larger") elif b > a: print(b, "is larger") else: print("Both numbers are equal")

Output:

Enter first number: 12 Enter second number: 25 25 is larger

Explanation: if - elif - else से तीनों cases (a बड़ा, b बड़ा, दोनों बराबर) handle होते हैं।

7दो Variables को Swap करना

x = 5 y = 10 print("Before swap: x =", x, ", y =", y) x, y = y, x print("After swap: x =", x, ", y =", y)

Output:

Before swap: x = 5 , y = 10 After swap: x = 10 , y = 5

Explanation: Python में tuple unpacking (x, y = y, x) से बिना तीसरे variable के swap हो जाता है। C या Java में इसके लिए temp variable चाहिए होता है।

8Leap Year Check करना

year = int(input("Enter a year: ")) if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): print(year, "is a Leap Year") else: print(year, "is not a Leap Year")

Output:

Enter a year: 2024 2024 is a Leap Year Enter a year: 1900 1900 is not a Leap Year

Explanation: Leap year वह साल है जो 4 से divisible हो लेकिन 100 से नहीं, या फिर 400 से divisible हो। इसीलिए 1900 leap year नहीं है, लेकिन 2000 था।

91 से 10 तक Numbers Print करना

for i in range(1, 11): print(i, end=" ")

Output:

1 2 3 4 5 6 7 8 9 10

Explanation: range(1, 11) 1 से 10 तक numbers देता है (आखिरी value 11 शामिल नहीं होती)। end=" " से हर number एक ही line में space के साथ print होता है।

10Factorial निकालना

num = int(input("Enter a number: ")) fact = 1 for i in range(1, num + 1): fact *= i print("Factorial of", num, "is", fact)

Output:

Enter a number: 5 Factorial of 5 is 120

Explanation: Factorial (n!) = 1 × 2 × 3 × ... × n। Loop हर number को fact से multiply करता जाता है। 5! = 120।

Hands-On Examples से सीखना क्यों जरूरी है?

  • Syntax याद रहती है: बार-बार type करने से syntax अपने आप याद हो जाती है।
  • Practical समझ बनती है: Concept किताब से नहीं, output देखकर समझ आता है।
  • Logical thinking बढ़ती है: हर program एक छोटी problem है, जिसे solve करना logic की practice है।

5 Extra Practice Programs

11Vowel या Consonant Check करना

ch = input("Enter a letter: ").lower() if ch in "aeiou": print(ch, "is a Vowel") else: print(ch, "is a Consonant")

Output:

Enter a letter: E e is a Vowel

Explanation: .lower() से capital letter भी small बन जाता है, फिर in operator check करता है कि letter "aeiou" में है या नहीं।

12Digits का Sum निकालना

num = int(input("Enter a number: ")) total = 0 while num > 0: total += num % 10 # last digit जोड़ो num //= 10 # last digit हटाओ print("Sum of digits:", total)

Output:

Enter a number: 1234 Sum of digits: 10

Explanation: % 10 से last digit मिलता है और // 10 (floor division) से last digit हट जाता है। 1 + 2 + 3 + 4 = 10।

13String को Reverse करना

text = input("Enter a string: ") print("Reversed:", text[::-1])

Output:

Enter a string: Uncodemy Reversed: ymedocnU

Explanation: [::-1] slicing है, जो string को पीछे से आगे की तरफ पढ़ता है। यह Python का सबसे छोटा reverse trick है।

14Sentence में Words गिनना

sentence = input("Enter a sentence: ") words = sentence.split() print("Total words:", len(words))

Output:

Enter a sentence: Python is very easy to learn Total words: 6

Explanation: split() sentence को spaces पर तोड़कर words की list बनाता है, और len() उस list की length देता है।

15Multiplication Table (पहाड़) Print करना

num = int(input("Enter a number: ")) for i in range(1, 11): print(num, "x", i, "=", num * i)

Output:

Enter a number: 7 7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 ... 7 x 10 = 70

Explanation: Loop 1 से 10 तक चलता है और हर बार number को i से multiply करके print करता है।

Quick Revision: कौन सा Program क्या सिखाता है?

Program Concept
Hello World, Greeting print() function, strings
Sum, Square Variables, arithmetic operators, ** operator
User Input input(), int() type conversion
Even-Odd, Larger Number, Leap Year if-elif-else, % operator, logical operators (and, or)
Swap Tuple unpacking
1 to 10, Factorial, Table for loop, range()
Sum of Digits while loop, %, //
Vowel-Consonant in operator, .lower(), strings
Reverse String String slicing [::-1]
Word Count split(), len(), lists

Absolute Beginners के लिए Python Tips

  • रोज़ practice करें: रोज़ 30 से 60 मिनट coding, हफ्ते में एक बार 5 घंटे से बेहतर है।
  • Error messages पढ़ना सीखें: Python का error message अक्सर बता देता है कि गलती किस line में और क्या है।
  • Online IDE use करें: शुरुआत में installation की झंझट न हो तो Replit या Google Colab जैसे online editors use करें।
  • छोटे projects बनाएं: हर नया concept सीखने के बाद उससे एक छोटा tool बनाने की कोशिश करें।
  • Structured course लें: Random videos की जगह एक step-by-step roadmap follow करें।

Daily Life में Simple Python Programs के Uses

  • Basic automation: Files rename करना, folders organize करना।
  • Data handling: Marks, expenses या attendance का हिसाब रखना।
  • Math helpers: EMI, interest, percentage जैसे calculations।
  • Text processing: Words गिनना, text clean करना, keywords ढूँढना।

Beginners के लिए Python Project Ideas

  • Simple Calculator: +, -, ×, ÷ operations के साथ (if-else और functions की practice)।
  • Quiz Game: सवाल पूछे और score बताए (lists और loops)।
  • Text-based To-Do List: Task add, delete और view करना (lists और menus)।
  • Number Guessing Game: random module से एक number चुने और user को guess करवाएं।

Python Programs से जुड़े FAQs

Q1. Beginners के लिए सबसे आसान Python programs कौन से हैं?

Hello World, दो numbers का sum, even-odd check, बड़ा number ढूँढना, leap year, factorial और multiplication table सबसे आसान और जरूरी starting programs हैं।

Q2. क्या ये simple programs interviews के लिए काफी हैं?

नहीं। ये programs basics मज़बूत करते हैं, लेकिन interviews के लिए problem-solving और Data Structures and Algorithms (DSA) जैसे topics भी सीखने ज़रूरी हैं।

Q3. Basics के बाद Python में आगे कैसे बढ़ें?

छोटे projects बनाएँ, Tkinter या Pandas जैसी libraries explore करें, और LeetCode या HackerRank जैसे platforms पर coding challenges solve करें।

Q4. Python सीखने में कितना समय लगता है?

Regular practice के साथ basics लगभग 1 से 2 महीने में आ जाते हैं, और अच्छी proficiency के लिए आमतौर पर 4 से 6 महीने लगते हैं।

Q5. Python में input() से number कैसे लें?

input() हमेशा string return करता है, इसलिए number के लिए int(input()) या decimal के लिए float(input()) लिखें।

Q6. क्या Uncodemy का Python course beginners के लिए सही है?

हाँ। Course बिल्कुल basics से शुरू होता है और धीरे-धीरे advanced topics, projects और placement preparation तक ले जाता है।

Q7. क्या Python course के बाद job मिल सकती है?

Uncodemy के course में placement support, mock tests, live projects और resume help मिलती है। Job आपकी skills और practice पर भी निर्भर करती है।

Key Takeaways

  • Python सीखने का सबसे अच्छा तरीका छोटे programs खुद लिखकर run करना है।
  • input() हमेशा string देता है, numbers के लिए int() या float() से convert करें।
  • % remainder देता है, // floor division करता है और ** power निकालता है।
  • इन 15 programs से variables, conditions, loops और strings, सब cover हो जाते हैं।
  • Basics के बाद projects और DSA की तरफ बढ़ें।

निष्कर्ष (Conclusion)

Python में मजबूत पकड़ बनाने के लिए consistency सबसे ज़रूरी है। ऊपर दिए 15 programs रोज़ एक-दो करके practice करें, फिर उनमें छोटे बदलाव करके देखें (जैसे table की 20 तक ले जाना, या factorial की function में बदलना)। जब ये programs आपको बिना देखें लिखने आ जाएँ, तब छोटे projects शुरू करें।

Python को structured तरीके से, projects और placement support के साथ सीखना चाहते हैं? Uncodemy का Python Course देखें।

Related Hindi Guides

नीचे दिए Hindi pages live होने के बाद इस blog में contextual links जोड़ें — जो page अभी live नहीं है, उसका link न डालें (404 से बचें)।

Topic Planned URL
Python for Loop /hi/blog/python-for-loop-with-examples
Python में Prime Number /hi/blog/python-code-to-check-prime-number
Armstrong Number /hi/blog/what-is-armstrong-number-definition-and-c-program
DSA Guide /hi/blog/what-is-dsa-data-structures-and-algorithms-complete-guide

Visit Us

Delhi Centre Address
2nd & 3rd Floor, Maa Katyayni Complex, MB-1E, Madhuban Rd, next to DSEU Ambedkar College, Laxmi Nagar, Shakarpur Extension, Shakarpur, Delhi, 110092
Opening hours
Monday – Sunday, 06:00 – 22:30
Website
uncodemy.com