0% found this document useful (0 votes)
8 views2 pages

Python Programs

Uploaded by

whitehari65
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
8 views2 pages

Python Programs

Uploaded by

whitehari65
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Module 2

1. "Write a program that computes the area of a circle. This program should
request a radius as input from the user. It should use the formula 3.14 * radius * 2 to
compute the area and then output this result suitably labeled"
2. Write a program that act as a calculator which can read input from the user and perform
operation such as addition, subtraction, multiplication and division
3. Write a python code to find the sum of digits for the given number
4. Write a python code to check the given number is prime or not using function
5. Write a python code to check the given number is armstrong number or not using
function
6. Write a python code to check the given number is palindrome or not using function
7. "Assume that the variable data refers to the string ""Python rules!"". Use a string
method to perform the following tasks:
a. Obtain a list of the words in the string.
b. Convert the string to uppercase.
c. Locate the position of the string ""rules"".
d. Replace the exclamation point with a question mark"
8. "Write a Python script to display the various Date Time formats.
a) Current date and time
b) Current year
c) Month of year
d) Week number of the year
e) Weekday of the week
f) Day of year
g) Day of the month
h) Day of week"

Module 3

1. Write a python code to find transpose of a matrix using list


2. Write a Python program to input a list of n numbers. Calculate and display the average of
numbers. Also display the cube of each value in the list.
3. Write a Python program to input a list of numbers. Calculate and display the sum of
cubes of each value in the list.
4. Let student = {'John':50, 'Tom' :60, 'Nina':82} be a dictionary. Discuss the output
obtained after executing the following statement.
newstudent = student
newstudent['Tom'] = 45
print newstudent
print student
5. Consider the list lst=[9,8,7,6,5,4,3]. Write the Python program which performs the
following operation without using built-in methods.
1) Insert element 10 at beginning of the list.
2) Insert element 2 at end of the list.
3) Delete the element at index position 5.
4) Print all elements in reverse order.
6. Let data = [23,56,67,2,[6,7,12],123].Write the expression for following operations
in Python: Replace the value 67 with 89 Print the value 12 Remove the value 56
from list
7. Write a python program to create a dictionary of phone number & names of
person. Display the contents of dictionary in alphabetical order of names
8. Let farm={'Sheep':5,'Cows':2,'Goats':10} be a dictionary. Write the statements for
following operations. To add the key value pair ('Ducks':8) .To display the number
of items in the dictionary.To remove the key value pair ('Cows':2)
9. Write a Python program to create a dictionary of roll numbers and names of 5
students. Display the contents of dictionary in alphabetical order of names.

Module 5
1. Write a pgm for creating a button widget and showing a msg when clicking the
button.
2. Write a program to create a simple GUI calculator using Tkinter

You might also like