Question: Use Python Shell Window to answer question 1 on a word file. Use Python Script Window and write a program for Q.2. to Q.4. Given

Use Python Shell Window to answer question 1 on a word file. Use Python Script Window and write a program for Q.2. to Q.4.

Given the string s = "Monty Python": (a) Write an expression to print the first character. (b) Write an expression to print the last character. (d) Write an expression that prints "Monty".

Given the string s = "homebody": (a) Write an expression using slicing to print "home". (b) Write an expression using slicing to print "body".

Given a variable s containing a string of even length: (a) Write an expression to print out the first half of the string. (b) Write an expression to print out the second half of the string.

Given a variable s containing a string of odd length: (a) Write an expression to print the middle character. (b) Write an expression to print the string up to but not including the middle character (i.e., the first half of the string). (c) Write an expression to print the string from the middle character to the end (not including the middle character).

Given the string s = "What is your name?": (a) What is returned by s [ : : 2] ? (b) What is returned by s [8: 2: -1]?

Given the string variable x = 'acegikmoqsuwy' and y = 'bdfhjlnprtvxz' , use indexing to create a string z that is the lowercase English alphabet.

What will be printed by the following? x = 'This is a test.' print(x * 3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!