calthoff / tstp

This is an old repository for the exercises in "The Self-Taught Programmer." Please see /selftaught.
166 stars 193 forks source link

Easier way to solve chapter 6 q10 #44

Closed PyProgrammer289 closed 2 years ago

PyProgrammer289 commented 2 years ago

I find the code:

sentence="It was a bright cold day in april, and the clocks were striking thirteen."

indexc=sentence.index(",")

print(sentence[:indexc])

more efficient since the solution provided makes the person have to count.

what you guys think?