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
Which of the following correctly describe the term readability as used in design
Lisa [10]

Readability is how legible the text is. Can you read the text easily?

8 0
3 years ago
Help me with this pleaseeee, i'll give brainliest
iren [92.7K]

Answer:

first question, to incremently increase

second is to generate a random number between the bounds of the min ,max

Explanation:

6 0
2 years ago
Which of the following best describes the views and arguments about the consequences of
Nitella [24]

Answer:- d)There are diverse views and arguments about the consequences of wearing  Google Glass.

Explanation:-Google glass is a eyeglass that was made with the head-mounted form for the wearable computer display.The glass works on the commands given by the voice.It can operate the internet service,camera, calendar etc.

The Google glass was discontinued because of the consequences of the glass.They were very high priced product and used to capture every picture that the user was looking at and also had issues related with minds .Thus, the correct option is option(d).

3 0
3 years ago
What are the important points
LUCKY_DIMON [66]

Answer:

You must evaluate information

Explanation:

The first step to thinking critically is to accept information only after evaluating it. Whether it's something read or heard, critical thinkers strive to find the objective truth. In doing this, these employees evaluate by considering possible challenges and solutions. This process of vetting new information and considering outcomes is called evaluation.

6 0
3 years ago
A technician is servicing a laptop that works properly when the power adapter is plugged in. Even though the battery icon shows
Oksanka [162]

Answer:

The laptop either does not have a battery or the battery no longer holds any charge, thus shutting down instantly.

Explanation:

Most laptops will first try to their battery as a power source, and will then try to use their charger as a battery source. The charger icon is most likely showing up as fully charged because the laptop doesn't know there isn't a battery present, and assumes that it is fully charged.

7 0
3 years ago
Other questions:
  • Matt wants to build an app that will reach many people all over the world. However, he worries about having to modify apps for a
    14·1 answer
  • Someone help ASAP! Match the type of information system with its description.
    13·2 answers
  • What is motivation and state the two forms​
    14·1 answer
  • Windows displays a(n)
    11·1 answer
  • PLEASE HURRY!!<br> Look at the image below
    6·1 answer
  • Which of the following substances increases in quantity during repititive muscle contraction during oxygen deficti ?
    11·1 answer
  • Write an algorithm and draw a flowchart for switching off a machine after it has made 500 glass bottles. use an appropriate cond
    10·1 answer
  • In contrast to data in a database, data in a data warehouse is described as subject oriented, which means that it _____.
    9·1 answer
  • Brainliest for correct answer
    13·2 answers
  • Algunos de los navegadores que existen son:
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!