Please Subscribe My YouTube Channel

Showing posts with label Python Program List. Show all posts
Showing posts with label Python Program List. Show all posts

Tuesday, June 23, 2026

Saving Calculator with Python

Saving Calculator with Python



#Importing Tkinter Library
import tkinter as tk

#Function to Add Expenses
def add_expense():
    global expense_entries, expenses_frame
    expense_name = expense_name_entry.get()
    expense_amount = float(expense_amount_entry.get())
    expense_entries.append((expense_name, expense_amount))
    update_expenses()
#Function to Update Expenses   
def update_expenses():
    global expenses_frame, expense_entries
    for widget in expenses_frame.winfo_children():
        widget.destroy()
    for i, (name, amount) in enumerate(expense_entries):
        tk.Label(expenses_frame, text=name, fg="white", bg="#735DA5", 
                 font=("Arial", 12, "bold")).grid(row=i, column=0, padx=5, pady=2, sticky="w")
        tk.Label(expenses_frame, text=amount, fg="white", bg="#735DA5", 
                 font=("Arial", 12, "bold")).grid(row=i, column=1, padx=5, pady=2, sticky="w")
#Function to Calculate Savings
def calculate_savings():
    total_expense = sum(amount for _, amount in expense_entries)
    savings = income.get() - total_expense
    savings_label.config(text=f"Savings: {savings}", fg="white", bg="#735DA5", font=("Arial", 12, "bold"))

#Function to Calculate Complete Expenditure
def calculate_complete_expenditure():
    total_expense = sum(amount for _, amount in expense_entries)
    total_expense_label.config(text=f"Total Expenditure: {total_expense}", fg="white",
                               bg="#735DA5", font=("Arial", 12, "bold"))
    calculate_savings()
#Creating Expense Entries List
expense_entries = []

#Creating the Tkinter Window
root = tk.Tk()
root.title("Savings Calculator with Satyam Sir")
root.configure(bg="#735DA5")

#Creating GUI Elements
# Income/Earning
tk.Label(root, text="Income/Earning -", fg="white", bg="#735DA5",
         font=("Arial", 12, "bold")).grid(row=0, column=0, padx=5, pady=2)
income = tk.DoubleVar()
tk.Entry(root, textvariable=income).grid(row=0, column=1, padx=5, pady=2)
 
# Expense Entry
tk.Label(root, text="Expense Name:", fg="white", bg="#735DA5",
         font=("Arial", 12, "bold")).grid(row=1, column=0, padx=5, pady=2)
expense_name_entry = tk.Entry(root)
expense_name_entry.grid(row=1, column=1, padx=5, pady=2)
 
tk.Label(root, text="Expense Amount:", fg="white", bg="#735DA5"
         , font=("Arial", 12, "bold")).grid(row=2, column=0, padx=5, pady=2)
expense_amount_entry = tk.Entry(root)
expense_amount_entry.grid(row=2, column=1, padx=5, pady=2)
 
# Add Expense Button
add_button = tk.Button(root, text="Add Expense", command=add_expense, fg="white",
                       bg="#D3C5E5", font=("Arial", 12, "bold"))
add_button.grid(row=3, columnspan=2, padx=5, pady=2)
 
# Expenses Frame
expenses_frame = tk.Frame(root, bg="#735DA5")
expenses_frame.grid(row=4, columnspan=2, padx=5, pady=2)
 
# Total Expenditure and Savings
total_expense_label = tk.Label(root, text="Total Expenditure: ", fg="white", bg="#735DA5", font=("Arial", 12, "bold"))
total_expense_label.grid(row=5, column=0, padx=5, pady=2)
savings_label = tk.Label(root, text="", fg="white", bg="#735DA5", font=("Arial", 12, "bold"))
savings_label.grid(row=6, column=0, padx=5, pady=2)
 
# Buttons to calculate total expenditure and savings
calculate_button = tk.Button(root, text="Calculate Expenditure", command=calculate_complete_expenditure, fg="white",
                             bg="#D3C5E5", font=("Arial", 12, "bold"))
calculate_button.grid(row=7, columnspan=2, padx=5, pady=2)

#Running the Application
root.mainloop()





Small MCQ App Creation in Python

Small MCQ App Creation in Python


#created by satyam sir
print('Welcome to ITCI Quiz')
answer=input('Are you ready to play the Quiz ? (yes/no) :')
score=0
total_questions=3
 
if answer.lower()=='yes':
    answer=input('Question 1: What is extension of python programming language?')
    if answer.lower()=='.py':
        score += 1
        print('correct')
    else:
        print('Wrong Answer')
 
 
    answer=input('Question 2: Who is father of HTML? ')
    if answer.lower()=='tim bearners lee':
        score += 1
        print('correct')
    else:
        print('Wrong Answer :(')
 
    answer=input('Question 3: What is extension of web page?')
    if answer.lower()=='.html' or '.htm':
        score += 1
        print('correct')
    else:
        print('Wrong Answer :(')
 
print('Thankyou for Playing this small quiz game, you attempted',score,"questions correctly!")
mark=(score/total_questions)*100
print('Marks obtained:',mark)
print("\n")
print('visit my site to learn more:- www.itcicomputerhardoi.blogspot.com')



Password Strength Notifier


Password Strength Notifier in Python

#created by Satyam Sir
def checkPassword(password):
    upperChars, lowerChars, specialChars, digits, length = 0, 0, 0, 0, 0
    length = len(password)

    if (length < 6):
        print("Password must be at least 6 characters long!\n")
    else:
        for i in range(0, length):
            if (password[i].isupper()):
                upperChars += 1
            elif (password[i].islower()):
                lowerChars += 1
            elif (password[i].isdigit()):
                digits += 1
            else:
                specialChars += 1

    if (upperChars != 0 and lowerChars != 0 and digits != 0 and specialChars != 0):
        if (length >= 10):
            print("The strength of password is strong.\n")
        else:
            print("The strength of password is medium.\n")
    else:
        if (upperChars == 0):
            print("Password must contain at least one uppercase character!\n")
        if (lowerChars == 0):
            print("Password must contain at least one lowercase character!\n")
        if (specialChars == 0):
            print("Password must contain at least one special character!\n")
        if (digits == 0):
            print("Password must contain at least one digit!\n")


password = input("Please enter password: ")
checkPassword(password)



Guess Number & Win Coin Program Python

Guess Number & Win Coin Program Python


#Project By Satyam Sir Hardoi (+91 9026728220)
#use when we hide any number and ask someone to guess number
import random
number=random.randint(1,5)
earn=0
print("Play & Guess Number")
while True:
    Guess_Number=int(input("Enter any number:- "))
    if number==Guess_Number:
        print("Correct Match")
        print("You have earn 100 Point")
        earn+=100
        print(earn)
        break
    else:
        print("Wrong Number")
print("I am going Home, Tata Bay Bay!")
#for exit console you can exit() or quit()
quit()



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}")





Tuesday, February 06, 2024

Reverse Number in Python with Slicing #Howto #Youtube #ITCIComputerHardo...

Reverse Number in Python

Wednesday, November 01, 2023

How To Create A Text Editor Such as Notepad with Python

How To Create A Text Editor Such as Notepad with Python

import tkinter

import os

from tkinter import *

from tkinter.messagebox import *

from tkinter.filedialog import *         




class Notepad:

    __root = Tk()


    # default window width and height

    __thisWidth = 500

    __thisHeight = 500

    __thisTextArea = Text(__root)

    __thisMenuBar = Menu(__root)

    __thisFileMenu = Menu(__thisMenuBar, tearoff=0)

    __thisEditMenu = Menu(__thisMenuBar, tearoff=0)

    __thisHelpMenu = Menu(__thisMenuBar, tearoff=0)


    # To add scrollbar

    __thisScrollBar = Scrollbar(__thisTextArea)

    __file = None


    def __init__(self, **kwargs):


        # Set icon

        try:

            self.__root.wm_iconbitmap("Notepad.ico")

        except:

            pass


        # Set window size (the default is 300x300)


        try:

            self.__thisWidth = kwargs['width']

        except KeyError:

            pass


        try:

            self.__thisHeight = kwargs['height']

        except KeyError:

            pass


        # Set the window text

        self.__root.title("Untitled - Notepad")


        # Center the window

        screenWidth = self.__root.winfo_screenwidth()

        screenHeight = self.__root.winfo_screenheight()


        # For left-alling

        left = (screenWidth / 2) - (self.__thisWidth / 2)


        # For right-allign

        top = (screenHeight / 2) - (self.__thisHeight / 2)


        # For top and bottom

        self.__root.geometry('%dx%d+%d+%d' % (self.__thisWidth,

                                              self.__thisHeight,

                                              left, top))


        # To make the textarea auto resizable

        self.__root.grid_rowconfigure(0, weight=1)

        self.__root.grid_columnconfigure(0, weight=1)


        # Add controls (widget)

        self.__thisTextArea.grid(sticky=N + E + S + W)


        # To open new file

        self.__thisFileMenu.add_command(label="New",

                                        command=self.__newFile)


        # To open a already existing file

        self.__thisFileMenu.add_command(label="Open",

                                        command=self.__openFile)


        # To save current file

        self.__thisFileMenu.add_command(label="Save",

                                        command=self.__saveFile)


        # To create a line in the dialog

        self.__thisFileMenu.add_separator()

        self.__thisFileMenu.add_command(label="Exit",

                                        command=self.__quitApplication)

        self.__thisMenuBar.add_cascade(label="File",

                                       menu=self.__thisFileMenu)


        # To give a feature of cut

        self.__thisEditMenu.add_command(label="Cut",

                                        command=self.__cut)


        # to give a feature of copy

        self.__thisEditMenu.add_command(label="Copy",

                                        command=self.__copy)


        # To give a feature of paste

        self.__thisEditMenu.add_command(label="Paste",

                                        command=self.__paste)


        # To give a feature of editing

        self.__thisMenuBar.add_cascade(label="Edit",

                                       menu=self.__thisEditMenu)


        # To create a feature of description of the notepad

        self.__thisHelpMenu.add_command(label="About Notepad",

                                        command=self.__showAbout)

        self.__thisMenuBar.add_cascade(label="Help",

                                       menu=self.__thisHelpMenu)


        self.__root.config(menu=self.__thisMenuBar)


        self.__thisScrollBar.pack(side=RIGHT, fill=Y)


        # Scrollbar will adjust automatically according to the content

        self.__thisScrollBar.config(command=self.__thisTextArea.yview)

        self.__thisTextArea.config(yscrollcommand=self.__thisScrollBar.set)


    def __quitApplication(self):

        self.__root.destroy()

        # exit()


    def __showAbout(self):

        showinfo("Notepad", "This is a simple Notepad editor created with Python with Tkinter. This editor can create new file, edit file ,cut,copy and paste features will be available ")


    def __openFile(self):


        self.__file = askopenfilename(defaultextension=".txt",

                                      filetypes=[("All Files", "*.*"),

                                                 ("Text Documents", "*.txt")])


        if self.__file == "":


            # no file to open

            self.__file = None

        else:


            # Try to open the file

            # set the window title

            self.__root.title(os.path.basename(self.__file) + " - Notepad")

            self.__thisTextArea.delete(1.0, END)


            file = open(self.__file, "r")


            self.__thisTextArea.insert(1.0, file.read())


            file.close()


    def __newFile(self):

        self.__root.title("Untitled - Notepad")

        self.__file = None

        self.__thisTextArea.delete(1.0, END)


    def __saveFile(self):


        if self.__file == None:

            # Save as new file

            self.__file = asksaveasfilename(initialfile='Untitled.txt',

                                            defaultextension=".txt",

                                            filetypes=[("All Files", "*.*"),

                                                       ("Text Documents", "*.txt")])


            if self.__file == "":

                self.__file = None

            else:


                # Try to save the file

                file = open(self.__file, "w")

                file.write(self.__thisTextArea.get(1.0, END))

                file.close()


                # Change the window title

                self.__root.title(os.path.basename(self.__file) + " - Notepad")



        else:

            file = open(self.__file, "w")

            file.write(self.__thisTextArea.get(1.0, END))

            file.close()


    def __cut(self):

        self.__thisTextArea.event_generate("<<Cut>>")


    def __copy(self):

        self.__thisTextArea.event_generate("<<Copy>>")


    def __paste(self):

        self.__thisTextArea.event_generate("<<Paste>>")


    def run(self):


        # Run main application

        self.__root.mainloop()


notepad = Notepad(width=800,height=500)

notepad.run()

Saturday, April 22, 2023

Calculation in Python (Add, Sub, Multi, Division, Square, and Module) IT...

Python Program No 1:-  
Calculation in Python(Add, Sub, Multi, Division, Square, & Module)