We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Lab Exercise – 2
1. Create a string containing both a single quote a double quote
2.Create a triple quoted string that contains single and double quotes. 3.Create a character, then obtain its integer representation. 4.Create a single string containing 5 copies of the string 'abc'. 5.Use the multiplication operator to create a "line" of 50 dashes. 6.Convert a string to all upper case. Q7 : Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string. Q8: a Python program to get a string from a given string where all occurrences of its first char have been changed to '$', except the first char itself. Sample String : 'restart' Expected Result : 'resta$t' Q9: Write a Python program to get a single string from two given strings, separated by a space and swap the first two characters of each string. Sample String : 'abc', 'xyz' Expected Result : 'xyc abz'