Please Subscribe My YouTube Channel

Sunday, June 21, 2026

Python Create KBC Software Mini Project

Python KBC Software Mini Project

#if not color work on idle then run it on cmd or powershell
#pip install colorama
#pip install threading
from colorama import init, Fore, Style
init(convert=True, autoreset=True)  # key line
import time
import threading
from colorama import Fore, Style, init
init(autoreset=True)


print(Fore.CYAN + "                             === Welcome to KBC===" + Style.RESET_ALL)
print(Fore.YELLOW + "                          Please Wait For Become Rich")


from colorama import init, Fore
from time import sleep

init(convert=True, autoreset=True)
for sec in range(5, -1, -1):  # 5 se 1 tak countdown
    print(f"                                  {Fore.GREEN} {sec}sec", end="\r")  # \r same line overwrite karega
    sleep(1)
print("\n\n")



# Timer ke liye global flag
#time_up= False

def timer(seconds):
    global time_up
    time.sleep(20)
    time_up= True
    print(f"\n{Fore.RED}⏰ Time Up!{Style.RESET_ALL}")

# KBC Questions - Aap aur add kar sakte ho
questions = [
    {
        "q": "Bharat ke pehle Pradhan Mantri kaun the?",
        "options": ["A. Sardar Patel", "B. Jawaharlal Nehru", "C. Lal Bahadur Shastri", "D. Indira Gandhi"],
        "answer": "B"
    },
    {
        "q": "Python programming language kisne banayi?",
        "options": ["A. James Gosling", "B. Guido van Rossum", "C. Dennis Ritchie", "D. Bjarne Stroustrup"],
        "answer": "B"
    },
    {
        "q": "Taj Mahal kahan sthit hai?",
        "options": ["A. Delhi", "B. Jaipur", "C. Agra", "D. Mumbai"],
        "answer": "C"
    },
    {
        "q": "Earth ka natural satellite kya hai?",
        "options": ["A. Mars", "B. Venus", "C. Moon", "D. Jupiter"],
        "answer": "C"
    },
    {
        "q": "Computer ka brain kise kehte hain?",
        "options": ["A. RAM", "B. CPU", "C. Hard Disk", "D. Monitor"],
        "answer": "B"
    },
    {
        "q": "Ganga nadi ka udgam sthal kya hai?",
        "options": ["A. Yamunotri", "B. Gangotri", "C. Gomukh", "D. Haridwar"],
        "answer": "B"
    },
    {
        "q": "HTTP ka full form kya hai?",
        "options": ["A. Hyper Text Transfer Protocol", "B. High Tech Transfer Process",
                    "C. Hyper Transfer Text Protocol", "D. None"],
        "answer": "A"
    },
    {
        "q": "Bharat Ratna se sammanit pehli mahila kaun thi?",
        "options": ["A. Indira Gandhi", "B. Mother Teresa", "C. Sarojini Naidu", "D. Lata Mangeshkar"],
                                                                                  
        "answer": "A"
    },
    {
        "q": "C programming kisne banayi?",
        "options": ["A. Guido van Rossum", "B. Dennis Ritchie", "C. James Gosling", "D. Linus Torvalds"],
        "answer": "B"
    },
    {
        "q": "Surya ka sabse nazdeek grah kaun sa hai?",
        "options": ["A. Venus", "B. Mercury", "C. Mars", "D. Earth"],
        "answer": "B"
    }
]

score = 0
prize_money = [1000, 2000, 3000, 5000, 10000, 20000, 40000, 80000, 160000, 320000]

for i, ques in enumerate(questions):
    global time_up
    time_up = False

    print(f"\n{Fore.YELLOW}Question {i+1} for Rs. {prize_money[i]}:{Style.RESET_ALL}")
    print(ques["q"])
    for opt in ques["options"]:
        print(opt)

    print(f"\n{Fore.GREEN}Timer: 20 seconds | A/B/C/D dabakar answer lock karo{Style.RESET_ALL}")

    # Timer start
    t = threading.Thread(target=timer, args=(20,))
    t.daemon = True
    t.start()

    # Input lene tak
    user_ans = None
    while not time_up and user_ans is None:
        user_ans = input("Aapka jawab: ").upper()
        if user_ans not in ['A', 'B', 'C', 'D']:
            print("Galat input! A/B/C/D me se chuno")
            user_ans = None
        time.sleep(0.1)

    if time_up:
        print(f"{Fore.RED}Sahi jawab tha: {ques['answer']}{Style.RESET_ALL}")
        break

    # Answer check
    if user_ans == ques["answer"]:
        score += 1
        print(f"{Fore.GREEN}Bilkul Sahi Jawab!{Style.RESET_ALL}")
    else:
        print(f"{Fore.RED}Galat Jawab! Sahi answer tha: {ques['answer']}{Style.RESET_ALL}")
        break

print(f"\n{Fore.CYAN}Game Over! Aapne {score} questions sahi kiye.")
print(f"Aapki jeet: Rs. {prize_money[score-1] if score > 0 else 0}{Style.RESET_ALL}")





No comments:

Post a Comment

*******Please Comment, Like and Share******
दोस्तों पूरी पोस्ट पढने के लिए धन्यवाद, आशा करता हूँ आप को यह पोस्ट पसंद आई होगी और भी अधिक जानकारी के लिए या मुझसे जुड़ने के लिए आप मुझे मेरे फेसबुक पेज information & technology computer institutions और इन्स्टाग्राम ID:- satyam_hardoi को फॉलो कर सकते है,
मेरा youtube चैनल itci computer hardoi सर्च करे और पाए कंप्यूटर से सम्बंधित सभी विडियो और हाँ प्लीज नई अपडेट पाने के लिए चैनल को सब्सक्राइब जरुर करें, धन्यवाद | आपका $ सत्यम सर् $