Bonus Practice Problems(GMT To IST) IST (Indian Standard Time) is 5 hours 30 minutes ahead of GMT(Greenwich Mean Time). Develop an algorithm and write the Python code to find day and IST, given day and time in GMT. For example, if day is Sunday and time in GMT is 23:05 then in IST is Monday (Next day) and time is 04:35. Check boundary conditions and print 'Invalid input' for wrong input. Write appropriate functions for accomplishing the task. Use rstrip() to remove extra spaces while reading strings Input Format Day Hours minutes of time in GMT Output Format Day Hours minutes of time in IST Boundary Condition: All hour > 0 and <24 Minutes > 0 and < 60 Seconds > 0 and <60 Day is Sunday or Monday or Tuesday or Wednesday or Thursday or Friday or Saturday Input: Take the input serially as day,hours and minutes. Processing Involved: days=["Sunday","Monday","Tuesday","Wednesday"...
PRACTICE PROBLEM 8 Verification of 'L' shaped arrangement of Coins on Game Board (Id-2435) Consider a nxn board game with four types of coins red, green, blue and yellow. Given the state of the board with coins in all cells, develop an algorithm and write a C program to check if the same coins are placed in ‘L’ shape on the board. The number of cells in the vertical and horizontal line of ‘L’ shape should be same and should be greater than 1. Red coins are represented by ‘r’, blue coins are represented by ‘b’, green coins are represented by ‘g’ and yellow coins are represented by ‘y’. For example, given the configuration of a 4 X 4 board with coins as shown below, b r y r r r y b y r b b b r r r the program must print 'Yes'. As there is a 'L' shape as shown in the figure below. Input Format Number of rows, r Number of columns, c Next ‘r x c’ lines contains the elements in the matrix Elements in the matrix given row by row ...
Practice Problem 6: Isophic Numbers: Given ‘n’ integers, write an algorithm and the subsequent Python code to print all numbers that are isophic to the first number. Two numbers with non-distinct (numbers in which digits get repeated) digits are said to be isophic if they have the same number of digits in it and the sets of positions having the same digits contains only even positions. Positions of digits are numbered from left to right starting from 1. For example: 12327 is isophic to 93538 . Both the numbers are of length five. In 12327, positions 2 and 4 have the same digit 2. Hence the set of positions having the same digit are {2,4}. Similarly , for the number 83538, the set of positions having the same digit is {2,4}. In both the numbers, the sets of positions having the same digit contains only even positions. 1232 is not isophic to 2342 because set of positions having same digits for 1232 is {{2, 4}} and for 2342 is {{1, 4}}. 12 is not isomorphic to 10, sinc...
Comments
Post a Comment