Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON (1) Ask the user for a string, then ask for the start and end slice. The string will be one input and then start

PYTHON

(1) Ask the user for a string, then ask for the start and end slice. The string will be one input and then start and end slice will be separated by a comma. (1 pt)

----------------------------------------------------------------------------------------------

Enter a string: This is a sample string Enter a start, end separated by a comma eg 1, -2: 5, 10 

----------------------------------------------------------------------------------------------

(2) Split the string given for the start and end slice and make convert them to integers. Output the start and end slice values on separate lines, then output the original string with that start and end slice. (2 pts).

----------------------------------------------------------------------------------------------

The start value is : 5 The end value is : 10 The value of 'This is a sample string'[5:10] is 'is a ' 

----------------------------------------------------------------------------------------------

(3) Output the

results of Capitalize.

number of n's.

'It ends with an !' if the last character is a !, otherwise output 'It does not end with a !'.

index of the first space,

index of the second space.

string lowered

string uppered

the results of replacing all the e's with 3's.

The string title cased.

----------------------------------------------------------------------------------------------

Capitalized : This is a sample string There are 1 n's. It does not end with a ! The first space is at index : 4 The second space is at index : 7 Lower cased : this is a sample string Upper cased : THIS IS A SAMPLE STRING In leet speak it is : This is a sampl3 string With title it is : This Is A Sample String 

----------------------------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions