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
Assume that a variable variable, number Of Sides has been initialized. Write a statement that assigns the value True to the vari
inna [77]

Answer:

public class ANot {

   public static void main(String[] args) {

   

       int numberOfSides = 20;

       boolean isQuadrilateral;

       if(numberOfSides==4){

           isQuadrilateral = true;

           System.out.println("The triangle is quadrilateral");

       }

       else{

           isQuadrilateral=false;

           System.out.println("The triangle is not quadrilateral");

       }          

}

}

Explanation:

  1. Create and Initilize the int  variable numberOfSides (You can also receive this from a user using the scanner class for example).
  2. create a boolean variable isQuadrilateral
  3. Use if and else statement to check if numberOfSides ==4 and assign true to isQuadrilateral else assign false
7 0
3 years ago
List two items that are required to make a text file into a bash script.
Olenka [21]

Answer:

Explanation:

First a header is needed indicating which bash will be used (sh, zsh, bash, etc.), then it is necessary to change the file extension so that the system recognizes it as an executable file and no longer as text

6 0
3 years ago
Using the functions from problems 1 and 2, write a MATLAB script to compare the laminar results from to the turbulent results. C
suter [353]

To start combining, select the Merge Mode option on the Comparison tab. Next, click the button next to the line you wish to merge in order to replace content from the right pane with content from the left pane.

<h3>How is boundary layer thickness calculated?</h3>
  • Where x is a position parallel to the wall, y is a coordinate normal to the wall, v is a (small) viscosity, u = (u, v) is the velocity, is the vorticity, and so on. The boundary conditions are as follows: u(x,y = +,t) = U, and u(x,y = 0,t) = 0.
  • To gauge the overall pressure, a vertically sliding Pitot tube is employed. So that the growth of the boundary layer in the flow direction can be seen, the total pressures can be recorded at various distances from the plate surface. Static pressure is gauged at a different measurement location.
  • To start combining, select the Merge Mode option on the Comparison tab. Next, click the button next to the line you wish to merge in order to replace content from the right pane with content from the left pane. Alternatively, you can pick a discrepancy and choose Replace Content from the Comparison tab.        

To learn more about Boundary conditions refer to:

brainly.com/question/23802083

#SPJ4

6 0
1 year ago
If the computer you are using is a laptop that moves from one network to another, you can click the _____ tab and configure stat
Leni [432]
If the computer you are using is a laptop that moves from one network to another, you can click the Alternate Configuration tab and configure a static IP address setting for a second network.
4 0
3 years ago
Outline three difference each of a raster filled and vector file​
Alekssandra [29.7K]

Answer:

Unlike raster graphics, which are comprised of colored pixels arranged to display an image, vector graphics are made up of paths, each with a mathematical formula (vector) that tells the path how it is shaped and what color it is bordered with or filled by.

Explanation:

7 0
3 years ago
Other questions:
  • Theâ ______ is a large worldwide collection of networks that use a common protocol to communicate with one another.
    5·1 answer
  • How can you find Web pages that contain news published during the past week?
    8·1 answer
  • Who was the 1st person to use the term television
    11·1 answer
  • The help desk received a call from a user who cannot get any print jobs to print on the locally shared printer. While questionin
    10·2 answers
  • Which of the following is a technique used by hackers to identify unsecured wireless network locations to other hackers?A. Blues
    10·1 answer
  • Which type of computing device is best suited to having a digital pen as an input device?
    9·1 answer
  • Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio
    15·1 answer
  • What do you do when you have computer problems? Check all that apply. PLEASE HELP
    9·2 answers
  • Pls help :( I am a radio and audio production student. What are two examples of a complex wave?
    10·1 answer
  • Mario is designing a page layout for a sports magazine, and he decides to add the image of a cyclist. Which principle of page la
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!