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]
4 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]4 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
Which cable would you check if you can't access any web pages?
ozzi

Answer:

If You Can't Access the Web

We'll assume that your Internet was working at an earlier point. If you are setting it up for the first time, the steps listed below were not designed with that purpose in mind. You need to follow the instructions that came with your router or modem.

I've included a series of definitions for the terminology used on this page.

Reboot the Computer

The first step should be rebooting your computer or device to see if that fixes the problem. You'd be surprised how often that simple step resolves issues.

If restarting your computer or device doesn't work, you'll have to check out each potential problem area to see if it restores access.

Check These Areas

The most likely problem areas related to a loss of Internet assess are one or more of the following:

your computer is disconnected from the network (check the network settings;

a proxy has been added to your browser or operating system;

your high-speed modem and/or router needs resetting or is disconnected;

a disconnected network cable (if your computer is wired);

your computer needs to reboot;

your firewall or security software is misconfigured; or

Your software is misconfigured for access to the Internet.

Progress through the suggestions on this page to test alternative solutions. I've presented them in the order I'd likely progress if I were to be assessing the problem and looking for solutions.

ISP Issues

If the issue is with your ISP or (rarely) a regional access issue, the resolution is beyond your control. You'll just have to wait for your ISP or the Internet structure to repair the problem.

5 0
3 years ago
Someone pleaseee answer my last question i just posted ;-;
USPshnik [31]
Lol sorry for wasting your time but I have to because it’s makin me answer questions
7 0
4 years ago
Read 2 more answers
What is the first thing Kernel does when WinLoad turns over the starttup process to it
SashulF [63]

It activates HAL, reads more information from the registry, and builds into memory the registry key

4 0
3 years ago
How do take a picture on this to ask?
Galina-37 [17]
What computer are you on, To take a screenshot on a chromebook press control shift then the switch screens button

If any other computer use snipping tool. Or look up how to screenshot on (Your computer)

Then click that paperclick and go to the file of the screenshot and click it. Then type in a question and click ask.
3 0
3 years ago
Use computer magazines and/or the internet to investigate one of these DBMSs: DB2, SQL Server, MySQL, Oracle, or Sybase. Prepare
tigry1 [53]

Answer:

The definition for the problem is listed in the section below on the explanations.

Explanation:

<u>For SQL Server</u>

  • Data Recovery: Data recovery is done well on SQL Server. It is achieved by the restoration method. Behind this, a sysadmin must reconstruct a collection of SQL backups throughout a restore series that is technically right as well as relevant.
  • Data Security: There are several approvals as well as limits for accessing main data objects or databases. These data are accessed only by the approved clients.
  • Concurrency Control: This is essentially synchronization of the evidence or information accessed by multiple users as well as from separate locations.

Concurrency or Competitiveness control becomes accomplished with SQL Server Portable, using locking to further improve security. The locking regulates how multiple individuals can simultaneously navigate & alter shared storage, without interfering with one another.

8 0
3 years ago
Other questions:
  • Technician A says a 2:1 gear ratio doubles the amount of torque. Technician B says a 2:1 gear ratio reduces the speed by half. W
    8·1 answer
  • What is the speedup of going from a 1-issue processor to a 2-issue processor? use your code from part a for both 1-issue and 2-i
    11·1 answer
  • . What is a "secondary dimension" in Google Analytics?
    9·1 answer
  • (1) Prompt the user to enter a string of their choosing. Output the string.
    11·1 answer
  • 9.2 code practice edhesive
    14·1 answer
  • Which of the following about Java arrays is true?
    14·1 answer
  • During the Inspect and Adapt event, how are reflection, data collection, problem solving, and identification of improvement acti
    5·1 answer
  • Many companies ban or restrict the use of flash drives
    11·1 answer
  • Jared is a corporate trainer who creates presentations to deliver at workshops. When creating these
    8·1 answer
  • Viruses that load from usb drives left connected to computers when computers are turned on are known as.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!