Professional Documents
Culture Documents
Assignment 2
Assignment 2
By Dr. J. P Mohanty
Programming Assignments on Functions and Randomness
Assignment 1:Digits
You are given a binary number n which contains only digits 0's and 1's. Your task is
to make all digits same by just flipping one digit (i.e. 0 to 1 or 1 to 0) only. Write a
function isFlip() to receive the binary number n and print ‘YES’ if it is possible to
make all the digits same by just flipping one digit else print 'NO'.
Example:
Input: 101
Output: Yes
Assignment 5:Letters
Write a function that accepts a sentence and returns the number of upper case
letters and lower case letters.
Input:The first line of the input contains a statement.
Output:Print the number of upper case and lower case respectively separated by a
space.
Example:
Input:Hello world!
Output:1 9