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
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
History,
12 hours ago
Computer Science,
12 hours ago
Math,
12 hours ago
English,
23 hours ago
Physics,
8 months ago