Answer:
The program is as follows:
word = input("Enter a word: ")
if word:
if len(word) <= 4:
word = word[::-1]
else:
word = word[0]+word[1]+word[-2]+word[-1]
print(word)
else:
print('empty!')
Explanation:
This gets input for word from the user
word = input("Enter a word: ")
If input is not empty
if word:
This checks if the length is less than or equal to 4 characters
if len(word) <= 4:
If yes, this reverses the word
word = word[::-1]
If otherwise,
else:
This gets the first, second, second to last two characters
word = word[0]+word[1]+word[-2]+word[-1]
Print the new string
print(word)
Print empty, if input is empty
<em>else:
</em>
<em> print('empty!')</em>
<span>The capacity of a communication channel is measured in gb and gps.</span>
There are two types of secondary memories.
- RAM
- ROM
RAM:
- RAM stands for random access memory .
- It is expandable.
- we can do multiple things in it.
- Its erasable.
ROM
- ROM stands for read only memory.
- It is permanent .
- We can only read in it.
- Its permanent hence not removable.