Strings



Exercise

1. Create a string variable to store this text Earth revolves around the sun,

     aPrint substring “revolves”

     b. Print substring “sun” using negative index

2. Create a string variable to store this text Earth revolves around the “sun” and print it

3. Create three string variables with values “I love eating“, “veggies”, “fruits”

     a. Print “I love eating veggies and fruits” (Hint: Use + operator)

     b. Create fourth variable to store number of fruits you eat everyday. Say for example you eat 2 fruits everyday, in that case print “I love eating 2 fruits everyday”


Download Answers