23CSS1 PYTHON PROGRAMMING LAB EXTERNAL
23CSS1 PYTHON SOC EXTERNAL LAB
========== ============== ========== ====== ======
1(a) Write a Python program to input angles of a triangle and check whether triangle is valid or not. Also validate the angles entered by the user. (sum of three angles of triangle is 180 degrees)
(b) Write
a program which makes use of function to display all such numbers which are
divisible by 7 but are not a multiple of 5, between 1000 and 2000.
c) Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. Suppose the following input is supplied to the program: 34, 67, 55, 33, 12, 98. Then, the output should be: ['34', '67', '55', '33', '12', '98'] ('34',67', '55', '33', '12', '98').
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
2(a) To find the GCD of 2 numbers using recursion.
(b) Write a python program to remove
duplicate elements from a list.
(c ) Write a python program to sort a tuple
of tuples by 2nd item.
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
3(a) Write a python program to Make a
game where the computer generates a random number, and the player has to guess
it.
Input
and Output values:
Input
values:
Player guesses the randomly generated number.
Output
value:
Feedback on whether the guess is correct, too high, or too low. Repeat until
the correct number is guessed.
(b) Write a python program to implement binary search
by using function and the numbers are not sorted. Use a sorting algorithm to
sort the numbers and pass the numbers as a parameters to binary search
function?
(c ) Write a
python program to write string as a record to file?
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
4(a)
Write a python Program to call data member and
function using classes and objects
(b) Write a python program to find all
occurrences of a substring.
(c ) i) Write a python program for creating a
nested dictionary?
ii) Write a python program to create a
dictionary with squares of numbers?
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
5(a) Write a program to compute
distance between two points taking input from the user Write a program add.py
that takes 2 numbers as command line arguments and prints its sum.
(b) i) Write a
python program for counting size of files in bytes & no.of lines?
ii) Write a python program to write
data to file using writelines()?
(c ) Write
a python script to perform Union, Intersection, difference and symmetric
difference.
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
6(a) Write
a program to count the numbers of characters in the string and store them in a
dictionary data structure Write a program to use split and join methods in the
string and trace a birthday of a person with a dictionary data structure
(b) Write
a python script to count all letters, digits and special symbols.
(c ) Write a python program to print GCD of a
given number using recurssion?
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
7 (a) Write a Python program to create
a simple game using Tkinter where a character
moves on arrow key presses. Implement event handling for left, right, up, and
down arrow keys.
(b)
Write a python program to unzip a list of tuples into individual lists.
(c ) Write a
Python program to read a random line from a file.
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
8 (a) Write a program to count frequency of characters in a given file. Can you use character frequency to tell whether the given file is a Python program file, C program file or a text file?
(b) Write
a python program to find out empty strings from a list of strings.
(c ) Write a python script to count the number of
strings in a list where the string length is 2 or more.
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
9 (a) Write a python program to print the pattern
(b) Write a
python program to find mean, median and mode.
(c ) Write a Python program to create and display all
combinations of letters, selecting each letter from a different key in a
dictionary. Sample data :
{'1':['a','b'], '2':['c','d']}
Expected Output:
ac ad bc
bd
$$$$$$$$$$$$$$$$$$$$$$$$#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$
10(a) Write a Python program using Tkinter that creates a label and a button. When the button is clicked, change the label text to "Button Clicked!".
(b ) Write a Python program to combine each line from first file with the
corresponding line in second file.?
(c ) Write a function dups to find all duplicates in the list.
Comments
Post a Comment