0% found this document useful (0 votes)
5 views14 pages

Programming in Python.24

The document contains a series of programming tasks in Python, each requiring the user to write a program to perform specific calculations or operations. Tasks include calculating areas, checking leap years, finding prime numbers, and manipulating lists. The document serves as a guide for practicing basic programming concepts and functions in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views14 pages

Programming in Python.24

The document contains a series of programming tasks in Python, each requiring the user to write a program to perform specific calculations or operations. Tasks include calculating areas, checking leap years, finding prime numbers, and manipulating lists. The document serves as a guide for practicing basic programming concepts and functions in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROGRAMMING IN PYTHON

WAP to read todays date (only date Part) from user. Then display
how many days are left in the current month.
Ans

WAP to print the area of circle when radius of the circle is given by
user.
Ans:

WAP to print the volume of a


cylinder when radius and height of the cylinder is given by user.
Ans

WAP that asks your height in centimeters and converts it into foot and
inches.
Ans

WAP to find area of a triangle.


Ans
WAP to calculate simple interest.
Ans

WAP to read a number in n and prints n2, n3, n4 Ans:

WAP to calculate compound simple interest after taking the principle,


rate and time.
Ans

WAP to check the given year is leap year or not.


Ans

WAP to take two numbers and check that the first number is fully
divisible by second number or not.
Ans

WAP to take the temperatures of all 7 days of the week and displays the
average temperature of that week.
Ans

WAP that searches for prime numbers from 15 through 25.


Ans

WAP to test if given number is prime or not.


Ans:
WAP to compute the result when two numbers and one operator is
given by user.
Ans:

WAP to calculate the roots of a given quadratic equation.


Ans

WAP to input
a digit and print
it in words.
Ans
WAP to check whether square root of a given number is prime or not.
Ans

WAP to print first n odd numbers in descending order.


Ans:

WAP to print the following series –


(i) 1 4 7 10 . . . . . . .40
(ii) 1 -4 7 -10 . . . . . . . . -40
Ans: (i)

(ii)

WAP to find the average of the


list of the numbers entered through keyboard.
Ans

WAP to find the largest number from the list of the numbers entered
through keyboard.

ANS.
WAP to find the 2nd largest number from the list of the numbers
entered through keyboard. (This program is from List Chapter)
Ans:

WAP to find the sum of n natural numbers.


Ans

WAP to find the sum of first n even numbers.


Ans

WAP to find the sum of first n odd numbers.


Ans

WAP to print the following pattern


(a) * (b) * (c) A (d)
0
* * ** AB 22
* ** *** ABC 444
* *** **** ABCD 8888
* **** ***** ABCDE

Ans: (a)
(b)

(c)

(d)

Write a python script that traverses through an input string and prints
its characters in different lines – two characters per line.
Ans:

Skill Based Questions


Q.1 WAP to print following pattern without using any nested loop.
#
## Ans:
###
####
#####
WAP to print the number of occurrences of a substring into a line.
Ans:
WAP to check the given string is palindrome or not.
Ans

WAP that:
o Prompt the user for a string o Extract all the digits from

the string.
o If there are digits
Sum the collected digits together.
Printout:
The original string
The digits
The sum of the digits
If there are no digits
Print the original string
A message “Has no Digits” Ans:

place. Only three types are mutable in python – Lists, Dictionaries and Sets.
Q.2 Start with the list[8,9,10]. Do the following using list functions
(a) Set the second entry (index) to 17
(b) Add 4, 5 and 6 to the end of the list.
(c) Remove the first entry from the list.
(d) Sort the list.
(e) Double the list.
(f) Insert 25 at index 3

(g) Ans: (a) list[1]=17 (b) [Link](4) [Link](5) [Link](6)


(c) [Link](0)

(d) [Link]()

(e) list=list*2

(f) [Link](3,25)

Q.1 WAP to find minimum element from a list of elements along with its
index in the list.
Ans: This program is for 1 or 2 marks
Or

WAP to calculate mean of a given list of numbers.


Ans:

OR

output
WAP to search for an element in a given list of numbers.
Ans

WAP to
count frequency of a given element in a list of numbers.

Ans:

Or

This program is for 3 or 4 marks

output

WAP to calculate the sum of integers of the list.


Ans

WAP that reverses an array of integers (in place)


Ans:

WAP that creates a third list after adding two lists.


Ans

WAP a program to generate a list of elements of Fibonacci Series.


Ans

WAP to read todays date (only date Part) from user. Then display how
many days are left in the current month.
Ans

You might also like