English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

Write a Python program to display the given pattern. C O M P U T E RC O M P U T E C O M P U T C O M P U C O M P C O MC O C - Computer Science

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?
Chapter 8: Strings and String manipulation - Evaluation [Page 130]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 8 Strings and String manipulation
Evaluation | Q 1. | Page 130
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×