Computer Science, asked by riyanshityagi1607, 23 hours ago

Consider the String s= "CHANDRAYAAN2" Write the statement in Python to implement the following punt_sum = num1+ num3 num3 intinum3) a) To display the string "CHAND"
b) To display the last four characters.
c) To repeat the string 2 times.
d) To display the output "CADAAN"
e) To display the substring "CHANDRA" in one line and "YAAN2" in second line.​

Answers

Answered by somnath91101
3

Answer:

a) print(s[0:4])

b) print(s[-4:])

c) print(s*2)

d) print(s[0]+s[2]+s[4]+s[s[2]*2+s[3])

e) print(f"{s[0:4} \n {5:}") #/n is used for a line gap

Hope it helps :)

Is it worth to be brainliest??

Similar questions