1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AfilCa [17]
3 years ago
6

Write a Python program which asks a user for a word and performs letters manipulation. If the word is empty, the program should

print the message empty! Otherwise, if the word has between one and four letters (inclusive), the program should print the reversed word. Otherwise, the program should print a word made of the first two and the last two letters of the original word. Your program should match the sample output as displayed below.
Sample Output
Enter a word:
Result: empty!

Enter a word: bio
Result: oib

Enter a word: memory
Result: mery
Computers and Technology
1 answer:
never [62]3 years ago
8 0

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>

You might be interested in
Suppose a process in Host C has a UDP socket with port number 6789. Suppose both Host A and Host B each send a UDP segment to Ho
Ann [662]

Answer:

Yes, both of these segments (A and B) will be directed to the same socket at Host C .

Explanation:

Suppose both Host A and Host B each send a UDP segment to Host C with destination port number 6789, surely , both of these segments will be directed to the same socket at Host C .

Reason being that,  the operating system will provide the process with the IP details to distinguish between the individual segments arriving at host C- for each of the segments (A and B) recieved at Host C.

5 0
3 years ago
Which of the following is NOT necessary for organizing data to make it easier to sort?
Elenna [48]

Answer:

All the data must be the same font and font size is not necessary for data sorting.

Explanation:

The most easier and frequently used tool for data organizing and sorting is Microsoft's excel or google spreadsheet. Sorting deals with arrangement of  data values in a particular sequence or order according to defined rules. For example data can be sort in ascending or descending order as per values or names in list.

7 0
3 years ago
Many ____ classes for certification are available on the Internet and by many companies that have set up intranets within their
Marina86 [1]

Many <u>online training</u> classes for certification are made available for students on the Internet and by many companies that have set up intranets within their organizations.

Certification can be defined as a recognition that is given to an individual (student) for the completion of a specific course of study and passing an examination. Thus, it usually issued to certify that an individual is a professional in a particular course of study.

Some examples of certifications that are issued to an individual (student) include the following:

  • CCNA
  • Comptia A+
  • HSE I and II

In this context, many companies with intranet facilities within their organizations offer <u>online training</u> classes for certification by making them available for students over the Internet.

Read more on certification here: brainly.com/question/1391803

5 0
2 years ago
"If a program attempts to modify (or, sometimes, even to read) the contents of memory locations that do not belong to it, the op
Monica [59]

The operating system's memory protection routine intervenes and (usually) terminates the program if a program attempts to modify (or, sometimes, even to read) the contents of memory locations that do not belong to it.

Further Explanation

The memory protection routine is most commonly used in multi-programmed systems to prevent one process from affecting the availability of another. When a user opens up multiple processes, by default, they usually reside at the same time in the main memory. Sometimes, a program may attempt to access, modify, or read memory locations allocated to other processes. When this happens, the memory protection program jumps in. Keep in mind that the memory manager somehow works hand in hand with the memory protection routine. It protects the OS from being accessed by other processes and these processes from accessing one another. In addition, it helps save memory by allocating the same amount of memory to all running processes. The memory protection program, on the other hand, should be able to allow controlled sharing of memory among different processes and will usually terminate a program that tries to modify content of memory locations of that does not belong to it.

Learn More about Memory management

brainly.com/question/14241634

#LearnWithBrainly

3 0
3 years ago
____ software is used to block unwanted e-mail and is available at many levels.
Anika [276]
Anti-spam <span>software is used to block unwanted e-mail and is available at many levels.</span>
3 0
3 years ago
Other questions:
  • Consider the provided C++ code in the main.cpp file: The function func2 has three parameters of type int, int, and double, say a
    8·1 answer
  • The entirety of a packet at one layer becoming the payload section at another layer is known as
    8·2 answers
  • Which following is one of the basic characters of object-oriented systems : Select one: a. process b. data c. module d. inherita
    6·1 answer
  • The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write a recursive
    7·1 answer
  • Which of the following languages does not provide built-in-pattern matching operations (the language, although, has pattern matc
    14·1 answer
  • Write a SELECT statement that uses an aggregate window function to get the total amount of each order. Return these columns: The
    13·1 answer
  • Convert octal number 2470 to decimal number
    14·2 answers
  • NEED HELP
    9·1 answer
  • a farmer cultivates 1/4 of his farm with ground nuts and 2/5 of it with maize what is the total landnarea that is cultivated​
    12·1 answer
  • Cómo fue posible que los alemanes exterminando seres humanos​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!