The Joy of Computing using Python Week 9: Programming Assignment - Jun-Dec 2021

NPTEL PROGRAMMING ASSIGNMENTS  


The Joy of Computing using Python


Week 9: Programming Assignment 1 - Snakes and Ladders I

Due on 2021-09-30, 23:59 IST

Given a configuration of a Snakes and Ladders board in the form of a mapping, determine the number of snakes and ladders.

Input Format be Like

First line of the input contains the board configuration in the form of mapping of snakes and ladders.

Output Format be like

Print two space separated integers indicating the number of snakes and ladders respectively.

For Example:

If Input is

6:14, 11:28, 17:74, 22:7, 38:59, 49:12, 57:76, 61:54, 81:98, 88:4

Then Output must be

4 6

Explanation:

In the given configuration, 6:14 indicates a ladder and 22:7 indicates a snake. There are 4 snakes and 6 ladders.

  

Week 9: Programming Assignment 2 - Snakes and Ladders II

Due on 2021-09-30, 23:59 IST

Given the configuration of a Snakes and Ladders board and a series of numbers obtained when the die is rolled, determine if the sequence of the die rolls leads to a win.

Input Format be Like    

First line of the input contains the board configuration in the form of mapping of snakes and ladders

Second line of the input contains comma separated integers indicating the values obtained on rolling a die.

Output Format b Like            

Print Yes if the sequence of roll die leads to a winning combination, No otherwise.

For Example:

If Input is

6:14, 11:28, 17:74, 22:7, 38:59, 49:12, 57:76, 61:54, 81:98, 88:4

6, 3, 4, 3, 5

Then Output must be

Yes

Explanation:

As per the given configuration, the above set of moves indicate that the winning number 100 is reached.  Hence this is a winning combination. (It is a winning combination if the set of die rolls lead to a number equal to 100 or exceeds 100).

 

Post a Comment (0)
Previous Post Next Post