Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Solve the following 1,4 3 2TT 5x- 1+ (15 x) dx 5X

Answered: 1 week ago

Question

Discuss consumer-driven health plans.

Answered: 1 week ago