Popular posts from this blog
Calculator using python tkinter
You can use the function to evaluate mathematical expressions entered by the user. You can also use Tkinter buttons and entry widgets to create a simple calculator interface. import tkinter from tkinter import * root=Tk() root.title("Simple Calculator") root.geometry("570x600+100+100") root.resizable(False,False) root.configure(bg="#17161b") equation = "" def show(value): global equation equation+=value label_result.config(text=equation) def clear(): global equation equation = "" label_result.config(text=equation) def calculation(): global equation result = "" if equation !="": try: result = eval(equation) except: result = "error" equation = "" l...
Password generator using python
import random lc="abcdefghijklmnopqrstuvwxyz" uc="ABCDEFGHIJKLMNOPQRSTUVWXYZ" nm="1234567890" sm="!@#$%^&*( ):;,./<>?" min_len=2 max_len=2 total_length=8 def generate_password(group,min_length,max_length): length=random.randint(min_length,max_length) sample=random.sample(group,length) string="".join(sample) return string def generate_string(): lower_string=generate_password(lc,min_len,max_len) upper_string=generate_password(uc,min_len,max_len) number=generate_password(nm,min_len,max_len) symbol=generate_password(sm,min_len,max_len) password=lower_string+upper_string+number+symbol if len(password)==total_length: password="".join(random.sample(password,len(password))) return password else: return generate_password() print(generate_st...
Comments
Post a Comment