Computer Science, asked by khusia20, 19 days ago

What will be the output of the given python program?
str="COMPUTER SCIENCE"
(a)print(str*2)
(b)print(str[0:7])​

Answers

Answered by uddin821
2

Answer:

print ("computer science")

Answered by guruu99
1

Answer:

(a) COMPUTERSCIENCECOMPUTERSCIENCE

(b) COMPUTECOMPUTE

There are two print statements in Python programming language that is provided.

Explanation:

There are two print statements in Python programming language that is provided. The string "COMPUTER SCIENCE" is printed twice in the first statement. This print statement produces the string "COMPUTER SCIENCECOMPUTER SCIENCE" as the result of multiplying the string "COMPUTER SCIENCE" by 2.

The substring of the string "COMPUTER SCIENCE" is printed in the second print statement. By slicing the string yields the substring. By providing the substring's starting and ending indexes, the slicing can be done. The substring displayed will be "COMPUTE" because the starting index is 0 and the ending index is 7. Therefore, the output for second print statement will be "COMPUTE."

To know more about python

https://brainly.in/question/49222417

https://brainly.in/question/55810297

#SPJ3

Similar questions