print("block 1")
str1 = "INST 126 is my first Python course"
print(str1[-6:len(str1)])
list1 = str1.split()
print(list1[len(list1)-1])
print("block 2")
str1 = "INST126"
print(str1[:4]+str(3)+str1[5:])
print("block 3")
groceries = ["eggs","ham","bacon","potatoes","cheese"]
for i in range(5):
item = groceries[i]
print(item)
print("block 4")
cars = ["bentley","honda","porsche","audi","toyota","ford"]
for car in cars:
if "o" in car:
print(car)


print ("block 1") tr1 "INST 126 is my first Python course print (strl[-6:1en (stri) 1 listit1.split O print (1isti[len (1ist1)-11) length exceeded i decresed 1 in this array index start from 0 to length-1 u can't access list(length) print ("block 2" str1INST126 rint (stri:1 +str (3) +stri[5:1) here casting problem. u can't combine string and integer i have casting as str(3) print ("block 3") groceries[eggs", "ham", "bacon","potatoes","cheese"] for i in range (5) item = groceries [1] print (item) print ("block 4") cars ["bentley", "honda", "porsche", "audi", "toyota", "ford"] for car in cars: if "。" in car: print (car)
block 1 cour3e cour3e block 2 INST326 1 block 3 eggs ham bacon potatoes cheese block 4 honda porsche toyota ford