Slip 12 A)
Write a Python GUI program to create a label and change the label font style
(font name, bold, size) using tkinter module.
Answer :
import tkinter as tk parent = tk.Tk()
parent.title("Welcome to College
Student");
my_label = tk.Label(parent,
text="Hello", font=("Arial Bold", 70)) my_label.grid(column=0, row=0)
parent.mainloop()
Output :
Slip 12 B)
Write a python program to count repeated characters in a string. Sample string:
'thequickbrownfoxjumpsoverthelazydog' Expected output: o-4, e-3, u-2, h-2, r-2,
t-2
Answer :
check_string="MalegaonBaramatiPune"
dict = {}
for ch in check_string:
if
ch in dict:
dict[ch] += 1
else:
dict[ch] = 1
for key in dict:
print(key, "-" , dict[key])
Output :
No comments:
Post a Comment