Computer Science, asked by akshayakaliraj23, 11 months ago

What is the value of second after executing the following lines? first = "tarantula" second = "" for i in range(len(first)-1,-1,-1): second = first[i] + second

Answers

Answered by sanjeethk2000
0

Answer:

'tarantula'

Explanation:

Answered by AskewTronics
0

"tarantula" is the correct answer for the above question

Explanation:

  • The value of the first variable is initialized in the second variable. It is because the loop scans all the character of the first variable in reverse order and the addition expressions add the character before the reserved character for the second variable.
  • The for loop scans in reverse order because the initial value of the loop is the last character and the ending value of the loop is the first character of the first variable value.
  • To concatenate the string any user needs a '+' operator and there is an additional operator in the for loop body which concatenates the character but the scans character fix before the stored character and the string will be the same as the first variable.

Learn More:

  • Python : https://brainly.in/question/14689905
Similar questions