0% found this document useful (0 votes)
66 views1 page

Python Lab

The document outlines programming assignments for three labs. Lab 1 involves writing procedures to solve quadratic equations, display grades for five subjects, check if a year is a leap year, and print prime numbers in a given range. Lab 2 involves writing programs to convert between decimal, binary, octal and hexadecimal, recursively compute exponents, and calculate Fibonacci numbers. Lab 3 involves writing programs to sort words and lists alphabetically without using sort functions, and calculate change using the minimum number of bills.

Uploaded by

AakashPrakash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views1 page

Python Lab

The document outlines programming assignments for three labs. Lab 1 involves writing procedures to solve quadratic equations, display grades for five subjects, check if a year is a leap year, and print prime numbers in a given range. Lab 2 involves writing programs to convert between decimal, binary, octal and hexadecimal, recursively compute exponents, and calculate Fibonacci numbers. Lab 3 involves writing programs to sort words and lists alphabetically without using sort functions, and calculate change using the minimum number of bills.

Uploaded by

AakashPrakash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab 1:

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)

You might also like