Question: #Python please!!! Write a function `middle_character(string)` that - prints the middle character(s) of the string. -if the string length is odd, there's only one middle

#Python please!!!

Write a function `middle_character(string)` that

- prints the middle character(s) of the string.

-if the string length is odd, there's only one middle character. For example, the middle character of "123" is '2';

-if the string length is even, there will be two middle characters. For example, the middle characters of "abcd" are "bc";

For example:

Test Result
middle_character('123')
2
middle_character('abcd')
bc

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!