# Problem Solving Methodology in IT (COMP1001) Assignment Four

\$30.00

Category:

## Description

5/5 - (1 vote)

1. [Weight = 2] (Letter counting) Write a function that will ask from user for a word consisting of
only letters in lower case and print out the frequency of the letters in the word. Make sure that you
include the function call in your .py file. A sample of the printout is given below.

2. [Weight = 4] (Binary number addition) In this question we revisit Q2 of Assignment 2 and
implement PROC0() and PROC1(). First of all, we use a list of three elements to implement the
these are the only possible outcomes of adding two binary digits.

With this tableAdd, implement the two functions PROC0() and PROC1() with the function
signatures below.
Function PROC0(digit1, digit2)

Input: digit1, digit2, each of which is either 0 or 1.

Output: a string of two digits which is the sum of the two
digits. Therefore, the result could be “00”, “01” or “10”.

Function PROC1(digit1, digit2, digit3)
Input: digit1, digit2, digit3, each of which is either 0 or
1.
Output: a string of two digits which is the sum of the three
digits. Therefore, the result could be “00”, “01”, “10”, or
“11”.

Also include the statements below in your .py file for testing.
print(PROC1(0,0,0))
print(PROC1(0,1,0))
print(PROC1(1,0,0))
print(PROC1(0,0,1))
print(PROC1(0,1,1))
print(PROC1(1,0,1))
print(PROC1(1,1,0))
print(PROC1(1,1,1))