# The Joy Of Computing Using Python Week 12 : Assignment 12 | NPTEL | Answers Jan 2023

## NLTK ________.

a. Helps to work with human language data.
b. Helps to convert machine data into human language.
c. Helps to work on gibberish language.
d. Helps to translate dog language into human language

a. Helps to work with human language data.

## The following code will return:

```def test(word):

new_word = ''
for ch in word:
if ch>='a' and ch<='z":

temp = ord(ch)
temp = temp - 32
temp = chr(temp)
new_word = new_word + temp

return new_word
```
a. Converting lower case letters into upper case.
b. Converting upper case letters into lower case.
c. Return the same word
d. Error

a. Converting lower case letters into upper case.

The test function takes a string word as input and returns a new string new_word that is the uppercase version of word.

The function achieves this by iterating over each character ch in word. If ch is a lowercase letter (as determined by the condition ch >= 'a' and ch <= 'z'), the function converts it to uppercase by subtracting 32 from its ASCII code using the ord function, then converting the resulting code back to a character using the chr function. The uppercase letter is then appended to new_word.

If ch is not a lowercase letter, it is ignored and not added to new_word. Finally, the function returns new_word.

It's worth noting that the function only works correctly for ASCII-encoded characters. If word contains non-ASCII characters, the behavior of the function is undefined.

## A complete graph will have a degree of separation.

a. 2
b. 1
c. 3
d. Depends on the number of nodes.

b. 1

a. (2,3)
b. (3,2)
c. (3,3)
d. (2,2)

a. (2,3)

## What should we do when encountered a sink?

a. Stop the algorithm.
c. Randomly choose a node from all nodes.
d. Randomly choose a node from neighbor nodes.