Assignments1 - Basic Python Programming
Assignments1 - Basic Python Programming
ME 781
(Basic Python Programming)
For the majority of this course, you will be working in Python notebooks on Google colab. Your LDAP ID
should provide you access to G-suite and thus colab. Please familiarize yourself with the working of
colab by logging in colab and going through the introductory resources. You will find a lot of resources
on learning python and in general machine learning at colab.
We will expect you to upload colab notebooks when you are required to turn your programming
assignments. Please make sure that you provide enough comments in the code for the TAs to
understand that you know what you are coding.
We have a software to check plagiarism in code, if anyone found copying the code, strict action will be
taken against such students and can also be given FR grade directly.
Assignment 1 instructions:
Please make sure that the program is so written that it is able to handle any invalid input (example a
negative integer, a float, a string, etc.).
Input Format
Define a subroutine/function that takes single input, where input could be any data type (string, integer,
floating)
Output Format
Sample Output 2
3 (3 is an int)
The famous Towers of Hanoi puzzle consists of 3 pegs (A, B, C) on one of which (A) are stacked n rings of
different sizes, each ring resting on a larger ring. The objective is to move the n rings one by one until
they are all stacked on another peg (B) in such a way that no ring is ever placed on a smaller ring; the
other peg (C) can be used as a workspace.
The minimal number of moves required to solve a Tower of Hanoi puzzle is 2n − 1, where n is the
number of disks.
Link: https://en.wikipedia.org/wiki/Tower_of_Hanoi
Input Format
Input Constraints:
n>0
n is a natural number
Output Format
Generate 3 lists corresponding to each tower and modify list at each step
Sample Input: 3
Sample Output
Explanation