Skip to content

nitrojacob/Algorithemic-Thinking-with-Python

 
 

Repository files navigation

Algorithemic-Thinking-with-Python

Directories

notebooks - jupyter notebooks based on Group B (Circuits Branches Syllabus)

  • Lab1 - First 3 experiments mentioned in syllabus forms Day 1 of lab Lab2 - Experiments 4 to 8 forms Day 2 of lab Lab3 - Experiments 9 to 14 forms Day 3 of lab Lab4 - Experiments 15 to 18 forms Day 4 of lab. prime.py in same folder is a helper code for this lab.

demos - Fun/Interesting problems for classroom demo/discussion

  • pi - Compute pi - montecarlo using random values
  • pi_nonrandom - Compute pi using monte-carlo but don't use random
  • hanoi - Tower of hanoi solver

Root Directory (Experiments from Group A syllabus)

1. Simple Desktop Calculator

Create a simple desktop calculator using Python. Implement only the five basic arithmetic operators.


2. String Operations

Create, concatenate, and print a string, and access a sub-string from a given string.


3. Display Date and Time

Familiarize yourself with displaying date and time in various formats. For example: Thu Jul 11 10:26:23 IST 2024.


4. List Operations with NumPy

Write a program to create, append, and remove elements in lists using NumPy.


5. Find Largest Number

Write a program to find the largest of three numbers.


6. Temperature Conversion

Convert temperature values back and forth between Celsius (c) and Fahrenheit (f).

  • Formula: c/5 = (f - 32)/9

7. Construct Star Patterns

Write a program to construct patterns of stars (*) using a nested for loop.


8. Prime Numbers Less Than N

Create a program that prints all prime numbers less than a given number N.


9. Factorial Using Recursion

Write a program to find the factorial of a number using recursion.


10. Recursive Addition

Write a recursive function to add two positive numbers.


11. Recursive Multiplication

Write a recursive function to multiply two positive numbers.


12. Recursive GCD

Write a recursive function to find the greatest common divisor (GCD) of two positive numbers.


13. Check Right Triangle

Create 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 this using functions.


14. Fibonacci Numbers Module

Write a program to define a module to find Fibonacci Numbers and import the module to another program.


15. Validate Mobile Number

Write a program to check whether a given number is a valid mobile number or not using functions.

  • Rules:
    • Every number should contain exactly 10 digits.
    • The first digit should be 7, 8, or 9.

16. Merge and Sort Lists by Even and Odd

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.


17. Sticks Game

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 their turn. A set contains 1, 2, or 3 sticks. The player who takes the last stick loses the game. The number of sticks in the set is to be input.


18. Game Show Problem (Monty Hall Problem)

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 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?

About

Lab and in-lecture-demos for the course UCEST105 "Algorithmic Thinking with Python" offered by KTU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 82.8%
  • Python 17.2%