Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python Exercise 4 Write a function to get a string s1 and returns a new string made of the first 2 and the last

In Pythonimage text in transcribed

Exercise 4 Write a function to get a string s1 and returns a new string made of the first 2 and the last 2 characters of the given string. If the string length is less than 2, return instead of the empty string. Sample Input 1 s1 = 'uabcs 2019' Expected Output 1 ua19 Sample Input 2 sl = 'ua' Expected Output 2 uaua Sample Input 3 s1 = 'u' Expected Output 2 "" (Empty 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

A Complete Guide To Data Science Essentials

Authors: Miguel

1st Edition

9358684992, 978-9358684995

More Books

Students also viewed these Databases questions