Question: Python : write a program called First 4 Last 4 . ask user for a string read string from user print true if the first

Python : write a program called First4Last4.
ask user for a string
read string from user
print true if the first four characters of string (from left to right) equal the last 4 characters of the string (from right to left)
if the string is too short (less than 8 chars) return false
HINT: if x = "hello", then x[0] is 'h', x[1] is 'e'
examples:
% python3 First4Last4.py
enter string: abc
string is too short
% python3 First4Last4.py
enter string: 12344321
True
% python3 First4Last4.py
enter string: 1234432
string is too short
% python3 First4Last4.py
enter string: 1234xx432
False
% python3 First4Last4.py
enter string: 1234xxxxx321
False
% python3 First4Last4.py
enter string: 1234xxxxx4321
True

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!