UCEST 105 Lab Cycle - 4

Learning Objective:
  • Learn to write functions and recursive functions
  • Learn list, tuples dictionaries and set
Functions and Recursive Functions
1.Write a function to find the sum of numbers between a lower bound and an upper bound
2.A program that accepts the lengths of three sides of a triangle as inputs. The program should output whether or not the triangle is a right triangle (Recall from the Pythagorean Theorem that in a right triangle, the square of one side equals the sum of the squares of the other two sides). Implement using functions.
3.Write a function that returns True if a given number is prime and False otherwise.Use this function to print all prime numbers less than N. Read N.
4.Write a Python program to calculate the area of a circle, given the center and a point on the perimeter. Use a function to find the radius as the distance between two points.
5.Compute nCr. Read 'n' and 'r'. Use your own factorial functions ( recursive)
6. Recursive function to add two positive numbers.
7. Recursive function to multiply two positive numbers.
8. Recursive function to find the greatest common divisor of two positive numbers.
9. Write a recursive function to generate n'th Fibonacci number.Use this function to generate Fibonacci series.
10. Program to check whether the given number is a valid mobile number or not using functions.
Rules:
1. Every number should contain exactly 10 digits.
2. The first digit should be 7 or 8 or 9

List, Dictionary, set ( try the various operators and functions before attempting programs)
1.Read 'n' numbers into a list and find the min,max,sum and average.
2.Read names of 'n' students into a list and sort them in alphabetical order.
3.Generate list of all even numbers less than 100. ( use list comprehension)
4. Input two lists from the user. Merge these lists into a third list such that in the merged list, all even numbers occur first followed by odd numbers. Both the even numbers and odd numbers should be in sorted order.
5.Implement the set operation on two sets ( Union, intersection, difference and symmetric difference)
6.Read a binary string and count the number of 1's and 0's .Use a dictionary to store the result.
7.Read a string and print the words in sorted order after removing duplicate words.( remove the repetition)
8.Find  the frequency of occurrence of each character in a string.( use dictionary)
9.Write a Python script to create a dictionary where the keys are numbers between 1 and 15 (both included) and the values are square of keys.
10.Write a Python program to read list of positive integers and separate the prime and composite numbers into two different list.( Use a function to check primality)
11.Write a program to read N words and display them in the increasing order of their lengths. The length of each word is also to be displayed.
12.Find the mode of elements in an array. Mode is the value that appears most frequently in the array

Comments

Popular posts from this blog

Algorithmic Thinking with Python UCEST 105- KTU First Semester BTech Course 2024 scheme notes pdf - Dr Binu V P 9847390760

UCEST 105 Lab Cycle - 1

Lab Experiments and Solutions - Algorithmic thinking with Python KTU S1 2024 scheme