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.
Answer:
D. smart phone
explanation;
a. what the heck is a radio going to do?
b. an HD television? is his job watching movies?
d. he already has a form of communication he uses, he needs something that can to both things at the same time
c. a smart phone can do everything he needs to do, likely faster than a landline phone or laptop.
Answer:
<u>Syntax of function in the Python Programming Language.</u>
def function_name():
'''body of the function or code'''
#calling of the function
function_name()
Note: In Python Programming Language, Indentation is sensitive if you not focus on the indentation then, you program occurs an indentation error.
Explanation:
In Python Programming language, we can use the "def" keyword to define a function then we write the name of the function and then use parentheses for the argument list. "#" is used for the single-line comment and " ''' ''' " is used for the multiple line comment.
A function is the part or module of the program which provides users the feature of reusability of that code anywhere only by calling them.