FUNDAMENTALS OF COMPUTER

COMPUTER PROGRAMMING FUNDAMENTALS

WHAT IS PROGRAMMING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If string ____ name=‘Patrick’, what is the value returned for string ____ name[2:3]?
A
‘t’
B
‘a’
C
‘r’
D
‘tri’
Explanation: 

Detailed explanation-1: -Python return string We can use the str() function to get the string representation of an object.

Detailed explanation-2: -Another way to return a string is by using a “return” statement at the end of the method. When a programmer writes a program, the compiler examines the return type. If the return type is set as “String”, then the added string will be returned.

Detailed explanation-3: -A string value is just a sequence of characters, like “abc” . A string value is always enclosed in quotes. All types of characters are allowed (even digits, as in “abc123” ). Strings can contain any number of characters.

Detailed explanation-4: -The value that a function returns to the caller is generally known as the function’s return value. All Python functions have a return value, either explicit or implicit.

There is 1 question to complete.