Advertisements
Advertisements
Question
Write a Python program to display the given pattern.
C O M P U T E R
C O M P U T E
C O M P U T
C O M P U
C O M P
C O M
C O
C
Short Note
Solution
Coding:
str 1=”COMPUTER”
index=len(str1)
for i in str1:
print(strl[0:index])
index-=1
Output:
>>>
RESTART: C:/Users/COMPUTER/
AppData/Local/Programs/Python/ Python37-32/compl.py ‘
COMPUTER
COMPUTE
COMPUT
COMPU
COMP
COM
CO
C
shaalaa.com
Programs Using Strings
Is there an error in this question or solution?