Python Code On String Module Below
import string
print(string.ascii_letters)
print(string.ascii_lowercase)
print(string.ascii_uppercase)
print(string.digits)
print(string.punctuation)
Python Code On String Module Below
import string
print(string.ascii_letters)
print(string.ascii_lowercase)
print(string.ascii_uppercase)
print(string.digits)
print(string.punctuation)
Below is the script for the age calculator software!
from tkinter import *
import tkinter as tk
def solution():
currentyear = currententry.get()
birthyear= birthentry.get()
finalanswer = int(currentyear) - int(birthyear)
answer.delete(0.0, END)
answer.insert(END, "You are ")
answer.insert(END, finalanswer)
answer.insert(END, " years old!")
window = Tk()
window.geometry("800x500")
window.title("Age Calculator")
title = Label(window,font=('Consolas',17,'bold'), text = "Welcome to Age Calculator!",fg="black")
title.grid(row=1,column=3,padx=70,pady=30)
currentyear = Label(window,font=('Consolas',17,'bold'),text = "Enter Your Current Year: ",fg="black")
currentyear.place(relx=.03,rely=.20)
currententry = tk.Entry()
currententry.place(relx=.41,rely=.22)
birthyear = Label(window,font=('Consolas',17,'bold'), text = "Enter Your Birth Year: ", fg ="black")
birthyear.place(relx=.03, rely =.35)
birthentry = tk.Entry()
birthentry.place(relx=.39,rely=.36)
calculate = Button(window,text = "Get Answer", font =('Consolas',15,'bold'),command=solution)
calculate.place(relx=.24,rely=.44)
answer = Text(window, height=6,width=30,font=('Consolas'))
answer.place(relx=.13,rely=.75)
window.mainloop()
Below is the script for the random number generator
import random
from tkinter import *
import tkinter as tk
def solution():
fromrange = fromentry.get()
torange= toentry.get()
finalanswer = random.randint(int(fromrange),int(torange))
answer.delete(0.0, END)
answer.insert(END, "The Answer is ")
answer.insert(END, finalanswer)
window = Tk()
window.resizable(0,0)
window.geometry("800x500")
window.title("Random Number generator")
title = Label(window,font=('Consolas',16,'bold'), text = "Welcome to random number generator",fg="black")
title.grid(row=1 ,column=3,padx=70,pady=30)
textrange = Label(window,font=('Consolas',17,'bold'),text = "Write the range of numbers",fg="black")
textrange.place(relx=.03 , rely=.25)
fromrange = Label(window,font=('Consolas',17,'bold'),text = "From:",fg="black")
fromrange.place(relx=.03 , rely=.35)
fromentry = tk.Entry()
fromentry.place(relx=.12,rely=.36)
torange = Label(window,font=('Consolas',17,'bold'),text = "To:",fg="black")
torange.place(relx=.34 , rely=.35)
toentry = tk.Entry()
toentry.place(relx=.40,rely=.36)
generate = Button(window,text = "Generate",font=('Consolas',15,'bold'),command=solution)
generate.place(relx=.24,rely=.44)
answer = Text(window, height=6, width=30,font=('Consolas'))
answer.place(relx=.13,rely=.75)
window.mainloop()
Below is the script for the Python Password Generator Program Script
import random
import string
numberofcharacters = int(input("How many characters do you want your password to be? > "))
letters = string.ascii_lowercase + string.ascii_uppercase + string.punctuation + string.digits
Password = "".join(random.sample(letters, k=numberofcharacters))
print("Your new password is",Password)
Below here is the source code for Drawing Application for kivy. Please if you like this content. Don't forget to Subscribe to my YouT...