Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 12 Answers

   Write a Python program

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 :

Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 12 Answers Savitribai Phule Pune University T.Y.B.B.A.(C.A.) Python Practical Slip 12 Answers Reviewed by technical_saurabh on December 31, 2021 Rating: 5

No comments:

Powered by Blogger.