Hacktoberfest 2023 Accepted - Super Fast PR Merge
import random
import datetime

class BankApp:
    bank_name = "AXIS"
    branch = "Vasna-Bhayali"
    IFSC = "Axis0003"
	
    def __init__(self, cname, pin, balance = 5000):
        self.customer_id = random.randint(111111,999999)
        self.account_no = random.randint(111111111,999999999)
        self.customer_name = cname
        self.pin = pin
        self.balance = balance

    def get_customer_details(self):
        print(f'''Customer ID: {self.customer_id}
	Customer Account Number: {self.account_no}
	Customer Name: {self.customer_name}
	Bank Balance: {self.balance}''')

    def get_branch_details(cls):
        print(f'''Bank Name: {cls.bank_name}
	Branch: {cls.branch}
	IFSC: {cls.IFSC}''')

    def get_balance(self):
        print(f'''The account balance is {self.balance} on {datetime.datetime.now()}''')

    def deposit(self, amt):
        self.balance += amt
        print(f'''The amount {amt} is successfully deposited to the account''')
        B1.get_balance()

    def withdraw(self,amt):
        if amt > self.balance:
            print("Insufficient Balance")
        else:
            self.balance -= amt
            print(f'''The amount {amt} is successfully deducted from your amount''')
            B1.get_balance()

    def get_loan(self, amt):
        if amt > self.balance*10:
            print("You are not eligible for amount  {amt}. You can get loan upto {self.balance*10}")
        elif self.balance < 10000:
            print("Insufficient account balance to apply for loan")
        else:
            self.balance += amt
            print("Congratulations, your loan has been approved, it is in process. The loan amount will be added to your account shortly.")
			
print("Welcome to AXIS Bank")
user_name = input("Enter the customer name: ")
pin = input("Enter the pin: ")
B1 = BankApp(user_name, pin)
count = 0
while True:
    print("How can we help you")
    print(
    f'''
    B - Balance
    C - Customer Details
    G - Branch Details
    D - Deposit
    W - Withdraw
    L - Loan
    E - Exit''')
    user_inp = input("Select any option: ").upper()

    if user_inp == "B":
        B1.get_balance()
    elif user_inp == "C":
        B1.get_customer_details()
    elif user_inp == "G":
        B1.get_branch_details()
    elif user_inp == "D":
        amount = int(input("Enter the amount to be deposited: "))
        B1.deposit(amount)
    elif user_inp == "W":
        amount = int(input("Enter the amount to be withdrawn: "))
        B1.withdraw(amount)
    elif user_inp == "L":
        amount = int(input("Enter the loan amount: "))
        B1.get_loan(amount)
    elif user_inp == "E":
        print("Thank you for banking with us")
        break
    else:
        print("invalid Option")
        count += 1
        if count == 3:
            break

    user_option = input("Do you want to continue? Yes/No ").upper()
    if user_option in ("YES","Y"):
        continue
    else:
        print("Thank you for banking with us")
        break
    break 

ATM.py
vrittles/Mini-Projects
import parser
from tkinter import *
root=Tk()
root.title("Calculator")

display=Entry(root)
display.grid(row=1,columnspan=6,sticky=W+E)

#get the user input and place it in the textfield

i=0
def get_variables(num):
    global i
    display.insert(i,num)
    i+=1

def clear_all():
    display.delete(0,END)

def undo():
    entire_string=display.get()
    if len(entire_string):
        new_string=entire_string[:-1]
        clear_all()
        display.insert(0,new_string)
    else:
        clear_all()
        display.insert(0,"Error")

def get_operation(opr):
    global i
    length=len(opr)
    display.insert(i,opr)
    i+=length

def calculate():
    entire_string=display.get()
    try:
        a=parser.expr(entire_string).compile()
        result=eval(a)
        clear_all()
        display.insert(0,result)
    except Exception:
        clear_all()
        display.insert(0,"error")






#adding button to the calculator

Button(root,text="1",command=lambda :get_variables(1)).grid(row=2,column=0)
Button(root,text="2",command=lambda :get_variables(2)).grid(row=2,column=1)
Button(root,text="3",command=lambda :get_variables(3)).grid(row=2,column=2)
Button(root,text="4",command=lambda :get_variables(4)).grid(row=3,column=0)
Button(root,text="5",command=lambda :get_variables(5)).grid(row=3,column=1)
Button(root,text="6",command=lambda :get_variables(6)).grid(row=3,column=2)
Button(root,text="7",command=lambda :get_variables(7)).grid(row=4,column=0)
Button(root,text="8",command=lambda :get_variables(8)).grid(row=4,column=1)
Button(root,text="9",command=lambda :get_variables(9)).grid(row=4,column=2)
Button(root,text="0",command=lambda :get_variables(0)).grid(row=5,column=0)

Button(root,text="AC",command=lambda :clear_all()).grid(row=5,column=1)
Button(root,text="=",command=lambda :calculate()).grid(row=5,column=2)
Button(root,text="->",command=lambda :undo()).grid(row=2,column=3)

Button(root,text="+",command=lambda :get_operation('+')).grid(row=3,column=3)
Button(root,text="-",command=lambda :get_operation('-')).grid(row=4,column=3)
Button(root,text="*",command=lambda :get_operation('*')).grid(row=5,column=3)
Button(root,text="/",command=lambda :get_operation('/')).grid(row=2,column=4)
Button(root,text="pi",command=lambda :get_operation('*3.14')).grid(row=3,column=4)
Button(root,text="%",command=lambda :get_operation('%')).grid(row=4,column=4)
Button(root,text="(",command=lambda :get_operation('(')).grid(row=5,column=4)
Button(root,text=")",command=lambda :get_operation(')')).grid(row=2,column=5)
Button(root,text="exp",command=lambda :get_operation('**')).grid(row=3,column=5)
Button(root,text="x!").grid(row=4,column=5)
Button(root,text="^2",command=lambda :get_operation('**2')).grid(row=5,column=5)








root.mainloop()
Calculator/tkinter calculator.py
vrittles/Mini-Projects

from tkinter import *
import random

BODY_PARTS = 3
SNAKE_COLOR = "#A6FF96"
FOOD_COLOR = "#F73D93"
BACKGROUND_COLOR = "#362FD9"
GAME_WIDTH = 500
GAME_HEIGHT = 500
SPEED = 250
SPACE_SIZE = 50


class Snake:
    def __init__(self):
        self.body_size = BODY_PARTS
        self.coordinates = []
        self.squares = []
        for i in range(0, BODY_PARTS):
            self.coordinates.append([0, 0])

        for x, y in self.coordinates:
            square = canvas.create_rectangle(x, y, x + SPACE_SIZE, y + SPACE_SIZE, fill=SNAKE_COLOR, tag="snake")
            self.squares.append(square)


class Food:

    def __init__(self):

        x = random.randint(0, (GAME_WIDTH / SPACE_SIZE)-1) * SPACE_SIZE
        y = random.randint(0, (GAME_HEIGHT / SPACE_SIZE) - 1) * SPACE_SIZE

        self.coordinates = [x, y]
        canvas.create_oval(x, y, x + SPACE_SIZE, y + SPACE_SIZE, fill=FOOD_COLOR, tag="food")


def next_turn(snake, food):

    x, y = snake.coordinates[0]
    if direction == "up":
        y -= SPACE_SIZE
    elif direction == "down":
        y += SPACE_SIZE
    elif direction == "left":
        x -= SPACE_SIZE
    elif direction == "right":
        x += SPACE_SIZE

    snake.coordinates.insert(0, (x, y))
    square = canvas.create_rectangle(x, y, x + SPACE_SIZE, y + SPACE_SIZE, fill=SNAKE_COLOR)
    snake.squares.insert(0, square)

    if x == food.coordinates[0] and y == food.coordinates[1]:
        global score
        score += 1
        label.config(text="Score:{}".format(score))
        canvas.delete("food")
        food = Food()

    else:
        del snake.coordinates[-1]
        canvas.delete(snake.squares[-1])
        del snake.squares[-1]

    if check_collisions(snake):
        game_over()

    else:
        window.after(SPEED, next_turn, snake, food)


def change_direction(new_direction):
    global direction
    if new_direction == 'left':
        if direction != 'right':
            direction = new_direction
    elif new_direction == 'right':
        if direction != 'left':
            direction = new_direction
    elif new_direction == 'up':
        if direction != 'down':
            direction = new_direction
    elif new_direction == 'down':
        if direction != 'up':
            direction = new_direction


def check_collisions(snake):

    x, y = snake.coordinates[0]

    if x < 0 or x >= GAME_WIDTH:
        return True
    elif y < 0 or y >= GAME_HEIGHT:
        return True

    for body_part in snake.coordinates[1:]:
        if x == body_part[0] and y == body_part[1]:
            return True

    return False


def game_over():

    canvas.delete(ALL)
    canvas.create_text(canvas.winfo_width()/2, canvas.winfo_height()/2,
                       font=('consolas',70), text="GAME OVER", fill="red", tag="gameover")


window = Tk()
window.title("Snake game")
window.resizable(False, False)

score = 0
direction = 'down'

label = Label(window, text="Score:{}".format(score), font=('consolas', 40))
label.pack()

canvas = Canvas(window, bg=BACKGROUND_COLOR, height=GAME_HEIGHT, width=GAME_WIDTH)
canvas.pack()

window.update()

window_width = window.winfo_width()
window_height = window.winfo_height()
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()

x = int((screen_width/2) - (window_width/2))
y = int((screen_height/2) - (window_height/2))

window.geometry(f"{window_width}x{window_height}+{x}+{y}")

window.bind('<Left>', lambda event: change_direction('left'))
window.bind('<Right>', lambda event: change_direction('right'))
window.bind('<Up>', lambda event: change_direction('up'))
window.bind('<Down>', lambda event: change_direction('down'))

snake = Snake()
food = Food()

next_turn(snake, food)

window.mainloop()
Snake Game/snake_game.py
vrittles/Mini-Projects
from itertools import product

def generate_variable_combinations(variables):
    """
    Generate all possible combinations of True and False values for a given list of variables.

    Args:
        variables (list): A list of variable names.

    Returns:
        list of tuples: A list of tuples where each tuple represents a combination of True and False
        values for the variables.

    Example:
    >>> generate_variable_combinations(['A', 'B'])
    [(False, False), (False, True), (True, False), (True, True)]
    
    >>> generate_variable_combinations(['X', 'Y', 'Z'])
    [(False, False, False), (False, False, True), (False, True, False),
     (False, True, True), (True, False, False), (True, False, True),
     (True, True, False), (True, True, True)]
    """
    return list(product([False, True], repeat=len(variables)))

if __name__ == "__main__":
    input_variables = input("Enter a list of space-separated variables: ").strip()
    variables = input_variables.split()
    combinations = generate_variable_combinations(variables)
    for combo in combinations:
        print(dict(zip(variables, combo)))

True_False_Combinations/true_false.py
vrittles/Mini-Projects
import random
import string

def generate_password(length=12):
    characters = string.ascii_letters + string.digits + string.punctuation
    password = ''.join(random.choice(characters) for _ in range(length))
    return password

# Example usage:
password = generate_password()
print(password)

passwordGenerator/pass.py
vrittles/Mini-Projects