Please Subscribe My YouTube Channel

Showing posts with label Viva O. Show all posts
Showing posts with label Viva O. 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')



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, January 14, 2024

O level Practical Viva All Extension's