python-basics-exercises icon indicating copy to clipboard operation
python-basics-exercises copied to clipboard

Possible Issue?

Open datalenk opened this issue 5 years ago • 3 comments

Hello, I'm going through the Python Basic book and going through the excersises and I've come across a possible code error in the PDF page 85, question 5. The solutions to exercises shows the solution, but when entered it doesn't show as True as the instructions says. I've already tried the solution on both Python 2 and Python 3 and no luck. Can someone, please advise?

Github: ch04-strings-and-string-methods/3-manipulate-strings-with-methods.py Python Basic book PDF: Pg: 85, Question 5

sc1 sc2 sc3

datalenk avatar Oct 26 '20 23:10 datalenk

@datalenk you'll have to use .strip() and .lower()

pratik-choudhari avatar Jan 12 '21 11:01 pratik-choudhari

Use lower for tge 1st and tge 3rd one. And use lower and strip for the 4th one. Which will give you the true answer for all the strings.

ghost avatar May 11 '21 10:05 ghost

string1="Becoomes" string2="becomes" string3="BEAR" string4=" bEautiful" print(string1.lower().startswith("be")) print(string2.startswith("be")) print(string3.lower().startswith("be")) print(string4.lower().strip().startswith("be"))

dreamssss04 avatar Jun 04 '22 01:06 dreamssss04