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
bekas [8.4K]
3 years ago
11

If my_string = "This is MY string!", why does print (my_string[0:7:5]) return "Ti" and not

Computers and Technology
1 answer:
notka56 [123]3 years ago
7 0

In Python, a string is an array of characters, we can access these characters using index operator []. For example, we have a_string = "Hello World" a_string[0] prints the first character in string ('H').

We can also use index operator to make substrings, for example a_string[0:3] will make a substring with first, second, third and fourth character equal to "Hell".

Now to business

my_string = "This is MY string!"

print(my_string[0:7]) # Prints "This is "

print(my_string[0:7:5]) # Prints "T" then prints the sixth character since we start counting at 0 hence prints "Ti" (note that space is also a character).

Hope this helps.

You might be interested in
given the numerical value 1010101.11, which of the following number systems is most likely represented.
nasty-shy [4]

Answer:

u have to give me more points

Explanation:

sorry

7 0
3 years ago
Instructions:Select the correct answer.
Dafna1 [17]
It would be a audio file -B.
8 0
3 years ago
(15) What is the best definition of a contextual tab?
katen-ka-za [31]

  1. What is the best definition of a contextual tab-<u>(c) A tab that appears in context with what you are working on</u>
  2. A theme can be applied to-<u>(d) All of the answers are correct</u>

Explanation:

  1. What is the best definition of a contextual tab-<u>(c) A tab that appears in context with what you are working on</u>
  2. A theme can be applied to-<u>(d) All of the answers are correct</u>
  3. What is the difference between Reading view and Slide Show view-<u>(c) Slide Show view contains annotation tools while Reading view does not</u>
  4. Which of the following is not a view available from the Presentation Views section of the View tab-<u>(a) Slide Show</u>
  5. Where can you find the command to access slide, note, or handout masters-<u>(d) View tab</u>
  6. To rotate a text box, which handle would you use-<u>(d) You must use the commands on the Home tab</u>
  7. To change a black and white, boring presentation into something a bit more pleasing to the eye, what option would be best-<u>(b) Templates</u>
  8. The area on the top of your PowerPoint screen, as seen in the image, is commonly referred to as the what-<u>(a) Menu Options</u>
  9. What does it mean when a command button is grayed out-<u>(c) The command is disabled and requires an action first.</u>
  10. The area on a slide that holds text that will appear in the presentation outline is a-<u>(a) text box</u>
  11. To easily find a presentation that you were working on earlier today, you could-(<u>c) all of the above</u>

6 0
3 years ago
Write a method that takes a RegularPolygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclus
Sergio [31]

Answer:

import java.lang.Object

import java.lang.Math

public class RegularPolygon  extends java.lang.Object{

  public void randomize(RegularPolygon c){

       int min = 10, max1 = 20;

       double  min1 = 5, max1 = 12;

       double range = (max - min) + 1;

       double range1 = (max1 -min1) + 1

       int side = (Math.random() * range) + min;

       double len = (Math.random() * range1) + min1;

       c.setNumSides(side);

       c.setSideLength( len);

 }

 public static void main(String[] args) {

    RegularPolygon r = new RegularPloygon();

    randomize(r);

 }

}

Explanation:

The randomize method accepts a regular polygon class as its only parameter and assigns a random number of sides and the length of these sides with the 'Math.random' function.

5 0
3 years ago
Positive thinkers tend to
andreev551 [17]

Answer:

I would say D hope this helps

3 0
3 years ago
Read 2 more answers
Other questions:
  • Binary is a sequence of 0s and 1s such as 1001101 which can be used to code information. To break a code, you need to find how m
    14·1 answer
  • The architecture that the large paper company Mohawk adopted enables the company to scale technology services up and down instan
    14·1 answer
  • Write a question that the database will understand. Which records are not equal to 5? &lt; 5 &gt; 5 &gt; =5 &lt; &gt; 5
    15·1 answer
  • A prime number is an integer that is divisible only by 1 and by itself. Write a program that: 1. Takes a number as an input. 2.
    5·1 answer
  • Variable-length entities. fixed-length entities. data structures that contain up to 10 related data items. used to draw a sequen
    14·1 answer
  • Which should be addressed by stakeholders when reviewing the problem statement? Select all that apply. All possible outcomes hav
    12·1 answer
  • What is the difference between i++ and ++ii?
    6·1 answer
  • A group consists of 10 kids and 2 adults. On a hike, they must form a line with an adult at the front and an adult at the back.
    10·1 answer
  • Can somebody tell me the Minecraft command to clear an entire world and destroy every block if u Dunno please don’t answer &gt;-
    13·1 answer
  • You are designing an exciting new adventure game and you want to attempt to explain where items that are carried by the player a
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!