Python Lab
Python Lab
1. Write a procedure that solves quadratic equation using the quadratic formula.
It should be taken as an argument of three nos. a,b,c.
It should also print error messages if a=0 or roots are complex, otherwise it
should print the two roots.
Modify your procedure to handle the case of complex roots.
2. Write a program to display grade and percentage for five different subjects.
3. Write a program to check a given year is leap year or not.
4. WAP to print the prime nos in a given range.
Lab 2:
1. WAP to convert decimal to binary ,octal and hexadecimal.
2. WAF that takes in a base and an exponential and recursively computes base to
the power exponential.
3. WAF that takes one argument n and computes F(n) the n is the nth value of the
fibonacci sequence.
Recall that the fibonacci series is defined by F(n) = F(n-1) + F(n-2) where F
(0)=0 and F(1)=1.
4. WAF for implementation of tower of hanoi problem.
Lab 3:
1. WAP to sort words in alphabetical order without using the sort function.
2. WAP for sorting the content of list or tuple without using the sort function.
3. A clerk works in a store, where the cost each item is a positive integer(in R
s) for example item may cost
Rs 21 but might not cost 9.99. In order to make a change a clerk has an unbou
nded no. of bills in each of
the denominations. Denominations->(1,2,5,10,20). WAP that takes two arguments
cost of the item and the amount paid and
prints how to make change using the
smallest possible no. of bills.
4. Convert the data given in the date format (dd/mm/yy)