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
kvv77 [185]
3 years ago
13

Given a string, return a version without the first and last char, so "Hello" yields "ell". The string length will be at least 2.

without_end('Hello') → 'ell' without_end('java') → 'av' without_end('coding') → 'odin'
Computers and Technology
1 answer:
shutvik [7]3 years ago
4 0

Answer:

<em>def without_end(strg):</em>

<em>    if len(strg)>2:</em>

<em>        return strg[1:-1]</em>

<em>    else:</em>

<em>        return strg</em>

   Explanation:

Given above is a function in Python for solving this problem, we can try different output for this program by calling this function in a print statement

print(without_end ("hello")) output ell

print(without_end ("java")) output av

print(without_end ("coding")) output odin

You might be interested in
The intended purpose of the following module is to determine whether the value parameter is within a specified range. The module
BARSIC [14]

The program does not consists of any syntax error but the module contains error in logic especially while placing the condition inside if statement.

Here we are actually planning to check whether the number passed in the “value” variable is within the given lower and upper range which is passed in second and third parameter.

Solution 1:

if value<=lower AND value>=upper Then

Display “The given number is outside the specified range.”

else

Display “The given number is within the specified range.”

End if

Alternate solution:

So for that the condition needs to be value>=lower and value <=lower. so  

if value > lower AND value <upper Then

Display “The given number is within the specified range.”

else  

Display “The given number is within the specified range.”

7 0
4 years ago
Write a C function namedliquid()that is to accept an integer number and theaddresses of the variablesgallons,quarts,pints, andcu
salantis [7]

Answer:

#include <stdio.h>

#include <math.h>

void liquid(int ,int*,int*,int*,int*);

int main()

{

int num1, gallons, quarts, pints, cups;  

printf("Enter the number of cups:");

scanf("%2d",&num1);  

liquid(num1, &gallons, &quarts, &pints, &cups);  

return 0;

}  

void liquid(int x, int *gallons, int *quarts, int *pints, int *cups)

{

static int y;

y = x;  

if (y >= 16)

{

*gallons = (y / 16);

printf("The number of gallons is %3d\n", *gallons);

}

if (y - (*gallons * 16) >= 4)

{

*quarts = ((y - (*gallons * 16)) / 4);

printf("The number of quarts is %3d\n", *quarts);

}

if ((y - (*gallons * 16) - (*quarts * 4)) >= 2)

{

*pints = ((y - (*gallons * 16) - (*quarts * 4)) / 2);

printf("The number of pints is %3d\n", *pints);

}

if ((y - (*gallons * 16) - (*quarts * 4) - (*pints *2)) < 2 || y == 0)

{

*cups = (y - (*gallons * 16) - (*quarts * 4) - (*pints *2));

printf("The number of cups is %3d\n", *cups);

}

return;

}

5 0
3 years ago
How do Europe and North America address the challenges of jurisdiction when a computer crime involves both continents?
Anastasy [175]

Answer:

A. Treaties

Explanation:

Based on the information provided within the question it can be said that in this type of situation where both countries are affected they usually enter into a treaty. This treaty represents an agreement between both countries on how they are going to handle the situation so that both countries get the justice that they want and therefore mutually benefit.

4 0
3 years ago
A technician is troubleshooting a small network with cable Internet service in which a user is receiving a message in her web br
Irina-Kira [14]

Answer:

True

Explanation:

The technician should first connect a computer directly to the cable modem and attempt to access the Internet, in order to ascertain the message been displayed on the screen. From there, he would know what to do to resolve the issue.

3 0
3 years ago
A network technician attempts to ping www.example.net from a customer computer, but the ping fails. access to mapped network dri
S_A_V [24]

It appears that the local network connection (ethernet, Wi-Fi, etc.) is working but the gateway to the WAN is down.

8 0
3 years ago
Other questions:
  • Google's stated mission is to: establish itself as the most valuable media company in the world. organize the world's informatio
    11·1 answer
  • __________ refers to the idea that eachemployee should report
    14·1 answer
  • Five aplications of ict​
    10·1 answer
  • Which UML relationships should be used between a subclass and a superclass? For example, suppose there is an interface or abstra
    5·1 answer
  • Plz help
    8·1 answer
  • Ben is writing web page content on a newly launched gaming gadget. He has to use hyperlinks to help visitors navigate to web pag
    11·1 answer
  • A ___________ variable is used to add up a set of values. fill in the blank
    8·1 answer
  • Help! ASAP! 1 Question.........°○°​
    11·1 answer
  • Write a program in Java to input a letter. If it is an uppercase letter then
    7·1 answer
  • D&gt; Windows is the most popular for ​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!