Question: Write a Python program which receives a string and returns a new string with the first 2 and the last 2 chars from a
Write a Python program which receives a string and returns a new string with the first 2 and the last 2 chars from a given string. If the string length is less than 2, print out an appropriate message to the user. (10 points) Sample input: Please enter a string: python Expected output: pyon Sample input: Please enter a string: py Expected output: pypy Sample input: Please enter a string: p Expected output: Your string is too short!
Step by Step Solution
There are 3 Steps involved in it
mainpy 1 def processstringinputstring if leninputstring 2 2 23 4 5 6 7 return ... View full answer
Get step-by-step solutions from verified subject matter experts
