The document outlines a lab cycle for the Algorithmic Thinking with Python course at the College of Engineering, Trivandrum, detailing various programming experiments to be completed by students. Each experiment includes tasks such as writing programs for basic arithmetic, string manipulation, recursion, and data structures, with specific deadlines for completion. The lab cycle emphasizes practical programming skills and problem-solving using Python.
The document outlines a lab cycle for the Algorithmic Thinking with Python course at the College of Engineering, Trivandrum, detailing various programming experiments to be completed by students. Each experiment includes tasks such as writing programs for basic arithmetic, string manipulation, recursion, and data structures, with specific deadlines for completion. The lab cycle emphasizes practical programming skills and problem-solving using Python.
ALGORITHMIC THINKING WITH PYTHON LAB Lab Cycle Cycle Sl.No Experiments Dead line 1 Write a program to display your name and address 2 Write a program to find the sum of two numbers. 3 Write a program to concatenate two string Write a program Swap two numbers 4 i) using another variable ii) Without using another variable 5 Write a program to find simple interest 6 Write a program to evaluate an expression d=a+b*c 7 Write a program to determine the grade earned by a student based on KTU grade scale C1 8 Write a program to print the given number is odd or even. 25 Oct 2024 9 Write a program to print the numbers from 1 to 50 in descending order 10 To print the Armstrong numbers in a given range. A number or string is input through the keyboard. Write a program to determine 11 if it’s palindromic. Write a program to check whether a particular date (dd-mm-yyyy format) 12 is valid. Those dates that lie in the range 01-01-1900 to 31-12-2050 are considered valid. 13 Simple desktop calculator using Python. Only the five basic arithmetic operators. 14 Create, concatenate, and print a string and access a sub-string from a given string. 15 Write a program to display alternate prime numbers till N (obtain N from the user). To determine the largest and smallest in a list of n numbers entered by the user and also 16 find the sum 17 Write a program to create, append and remove lists in python using Numpy. 18 Write a program to count the number of words in a sentence. Convert temperature values back and forth between Celsius (c), and Fahrenheit (f). 19 [Formula: c/5 =f-32/9] Program to construct patterns of stars (*), using a nested for loop. a) * b) * c) * C2 (Draw the flowchart ** * * * * using raptor 20 *** * * * * * * 15 Nov 2024 tool and write the **** * * * * * * * * program) ***** * * * * * * * * ****** * * * * * * * * * 21 Write a program to find a factorial of a number using Recursion. 22 Recursive function to add two positive numbers. 23 Recursive function to find the greatest common divisor of two positive numbers. Program to define a module to find Fibonacci Numbers and import the module to 24 another program. A program that accepts the lengths of three sides of a triangle as inputs. The program 25 should output whether or not the triangle is a right triangle using Pythagorean Theorem. Implement using functions. Create a telephone directory using a dictionary. The name of the individ- ual and the telephone number will be key and value, respectively. Write a Python program that allows the user to perform the following operations: (a) Add a Contact: Add a new contact with a name and phone number to the directory. (b) Update a Contact: Update the phone number of an existing contact. 26 (c) Delete a Contact: Remove a contact from the directory. (d) Search for a Contact: Look up the phone number of a contact by their name. (e) Display All Contacts: Print all contacts in the directory. (f) Exit the program. Use a menu-driven approach. You are given the task of calculating the electricity bill of a house. Each house has the following components: fan, light, washing machine, and computer. Each fan consumes 1 unit per day, and each light consumes 0.5 units per day, the washing machine consumes 2 units per day and each 27 computer consumes 3 units per day. Let the cost of 1 unit be 50 rupees. Input the number of fans, lights, washing machines, and computers for a particular house and find the total electricity bill for that house for 2 months. Assume a 30-day month. Input two lists from the user. Merge these lists into a third list such that in the merged 28 list, all even numbers occur first followed by odd numbers. Both the even numbers and odd numbers should be in sorted order. Write a program to play a sticks game in which there are 16 sticks. Two players take turns to play the game. Each player picks one set of sticks (needn’t be adjacent) during 29 his turn. A set contains 1, 2, or 3 sticks. The player who takes the last stick is the loser. C3 The number of sticks in the set is to be input. 13 Dec 2024 Use brute force to find the element that appears most frequently in an array by counting the occurrences of each element and selecting the one 30 with the highest count. This involves iterating through the array and maintaining a count for each element. Use divide and conquer to find the element that appears most frequently in an array. Divide the array into two halves, find the most frequent 31 element in each half, and combine these results to determine the overall most frequent element. Apply dynamic programming to determine the number of ways to climb a staircase with n steps, where you can take 1 or 2 steps at a time. This 32 method builds solutions incrementally by storing the number of ways to reach each step. Develop a greedy algorithm to manage traffic flow by optimizing traffic light timings at intersections. 33 Example: Intersections with traffic volumes [500 vehicles/hour, 300 vehi- cles/hour, 400 vehicles/hour, 600 vehicles/hour] would adjust lights in the order [4, 1, 3, 2]. Suppose you're on a game show, and you are given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who 34 knows what is behind the doors, opens another door, say No. 3, which has a goat. He then asks, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? Implement a Python function to simulate rolling a six-sided die once. Print 35 the number rolled.