Computer Science, asked by mundehariprasad0, 2 months ago

items = ["CPU" , "Printer", "GPU" , "Router" , "Speaker"]
print ([items] [ 0:2])

Output = ["CPU" , "Printer", "GPU" , "Router" , "Speaker"]
Why is out put not - ["CPU" , "Printer", "GPU"]

Answers

Answered by aj200260
0

Answer:

THE OUTPUT IS NOT - ["CPU,"Printer","GPU"} BECAUSE IN THE PRINT STATEMENT WE HAVE INCLUDED THE ENTIRE LIST (ALL THE ELEMENTS)

print([items] [0:2]) --THIS WILL INCLUDE ALL THE ELEMENTS IN THE LIST

WHEREAS IF THE PRINT STATEMENT WAS  

print([0:2]) -- THEN THE OUTPUT WILL BE-["CPU","Printer","GPU"]

NOTICE THE DIFFERENCE IN BOTH THE PRINT STATEMENTS?

HOPEFULLY THIS MIGHT HAVE HELPED YOU!

Answered by Anonymous
0

Phenol

Phenol (also called carbolic acid) is an aromatic organic compound with the molecular formula C6H5OH. It is a white crystalline solid that is volatile.

Similar questions