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
Lorico [155]
3 years ago
12

#Write a function called "scramble" that accepts a string #as an argument and returns a new string. The new string #should start

with the last half of the original string #and end with the first half. # #If the length of the string is odd, split the string #at the floor of the length / 2 (in other words, the second #half is the longer half). # #For example: # scramble("abcd") -> "cdab" # screamble("abcde") -> "cdeab" # scramble("railroad")) -> "roadrail" # scramble("fireworks")) -> "worksfire"
Computers and Technology
1 answer:
mojhsa [17]3 years ago
8 0

Answer:

def scramble(s):

   if len(s) % 2 == 1:

       index = int(len(s)//2)

   else:

       index = int(len(s)/2)

   

   return s[index:] + s[:index]

Explanation:

Create a function called scramble that takes one parameter, s

Check the length of the s using len function. If the length is odd, set the index as the floor of the length/2. Otherwise, set the index as length/2. Use index value to slice the s as two halves

Return the second half of the s and the second half of the s using slice notation (s[index:] represents the characters from half of the s to the end, s[:index] represents the characters from begining to the half of the s)

You might be interested in
A common preprocessing step in many natural language processing tasks is text normalization, wherein words are converted to lowe
Arturiano [62]

Answer:

def normalize(text):

   text = text.lower()

   text = text.split()

   return text

Explanation:

The functiinfunction is provided with an input text when called upon, then it changes every character in the text into lower case and split each word with a space.

4 0
3 years ago
Andy wants to install a new Internet connection. He wants to take the fastest he can get. What are the maximum speeds for the fo
aksik [14]

Answer:

1. so if i wanted to build a linux server for web services(apache) with 1cpu and 2 gb of memory.-operating at 75% of memory capacity2. a windows server with 2 cpu/ 4gb memory- operating at 85% of memory capacity3. a storage server with 1 cpu/ 2gb memory- operating at 85% of memory capacityhow much memory do i have to add for each server. so that the utilization rate for both cpu and memory is at a baseline of 60%."the details for the cpu like its processor or the memory's speed isnt to be concerned" yeah i kept asking my teacher if he's even sure about the but the whole class seems to be confused and the project is due in 3 days..this is a virtualization project where i have to virtualize a typical server into an exsi hypervisor.

5 0
3 years ago
What principle of interaction is John using?
Rainbow [258]

Answer:

but which john

Explanation:

man people don't make sense you more man

8 0
3 years ago
Read 2 more answers
Which of these devices features D-pads and analog sticks? ASAP PLEASE
Arisa [49]

Answer:

b. portable consoles

Explanation:

hope that helps :)

5 0
3 years ago
Read 2 more answers
Define latency and jitter for service flow in a fixed wireless system.
Marianna [84]

Answer:

Jitter refers to deviations in displacement of or deviation in the signal pulses in a HF digital signal. Latency  refers to the time interval between the response and stimulation or the basic delay between the effect and cause in service flow.

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • How we can get NET I'D by IP Address?
    11·1 answer
  • A simulation model includes: a. a description of the components of the system. b. a simulation clock. c. a definition of the sta
    8·1 answer
  • Monitors display images by using a grid made up of millions of tiny dots, called ________.
    13·1 answer
  • Drag each label to the correct location on the image.
    7·1 answer
  • Select all the items of the Design Elements.
    7·1 answer
  • Binary is best interpreted by a computer because ​
    12·2 answers
  • Which of the following statement is correct ? A . potential difference is measured by ammeter . B . The unit of potential differ
    9·1 answer
  • Helppppppppppp please
    5·2 answers
  • True or false The List interface defines a collection for storing elements in a sequential order.
    14·1 answer
  • Can someone follow my tt its c1ndy.dont.miss
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!