Skip to content

Repository files navigation

Hey Everyone, This Repository contains my Codes of Practical Questions that I've been practising in My Generic Elective Paper "Programming using Python" for Semester 1 in Delhi University. For Complete Information, you can refer to the following file: http://www.du.ac.in/uploads/RevisedSyllabi1/Annexure-86.%20(Comp-Sc-GE).pdf Further, For convenience, I'm adding the Respective Questions here as well.

Question 2

Write a Python function to produce the outputs such as:

(a) 1 21 321 4321 b) 1 121 12321 1234321 12321 121 1

Question 3

Write a Python program to illustrate the various functions of math module.

Question 4

Write a Python program to produce a table of sins, cosines and tangents. Make a variable x in range from 0 to 10 in steps of 0.2. For each value of x, print the value of sin(x), cos(x) and tan(x).

Question 5

Write a program that reads an integer value and prints “leap year” or “not a leap year”

Question 6

Write a menu driven program to calculate the area of given building. Accept suitable inputs and use suitable assertions.

Question 7

Write a Python function that takes a number as an input from the user and computes its factorial.

Question 8

Write a Python function to generate the Fibonacci sequence till a given number “n”.

Question 9

Write a function that takes a number as an input and finds its reverse and computes the sum of its digits.

Question 10

Write a function that takes two numbers as input parameters and returns their least common multiple. 

Question 11

Write a function that takes a number as an input and determine whether it is prime or not.

Question 12

Write a function that finds the sum of the
 a) first n odd terms
 b) first n even terms
 c) 1, 2, 4, 3, 5, 7, 9, 6, 8, 10, 11, 13.. till n-th term

Question 13

Write a Python function that takes a string as an input from the user and determines whether it is palindrome or not.

Question 14

Write a function that takes a sentence as input from the user and calculates the frequency of each letter. Use a variable of dictionary type to maintain the count.

Question 15

Write a Python function that prints a dictionary where the keys are numbers between 1 and 5 and the values are cubes of the keys.

Question 16

Consider a tuple t1=(1,2,5,7,9,2,4,6,8,10). Write a program to perform following operations:
 a. Print half the values of tuple in one line and the other half in the next line.
 b. Print another tuple whose values are even numbers in the given tuple.
 c. Concatenate a tuple t2=(11,13,15) witht1.
 d. Return maximum and minimum value from this tuple.

Question 17

Write a function called “check_duplicates” that takes a list and returns true if there is any element that appears more than once. Also find the frequency of that element. The original list should not be modified.

Question 18

Write a program to implement a class for finding area and perimeter of a rectangle. Write constructor, destructor, and functions for calculating area and perimeter.

Question 19

Write a menu driven program to perform the following functions on strings:
 a. Find the length of string
 b. Return maximum of three strings
 c. Accept a string and replace every successive character with ‘#’ Example: For Given string ‘Hello World’ returned string is ‘H#l#o W#r#d’.
 d. Find number of words in the given string

Question 20

Write a Python program to perform the following using list:
 a. Check if all elements in list are numbers or not
 b. If it is a numeric list, then count number of odd values in it
 c. If list contains all Strings, then display largest String in the list
 d. Display list in reverse form
 e. Find a specified element in list
 f. Remove the specified element

About

This Repository contains my Python codes which I'm performing during my Graduation.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages