Python Forum
Optimizing string capitalization challenge
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimizing string capitalization challenge
#4
You didn't understand the hint. I meant
def old_macdonald(name):
    return name[:4].capitalize() + name[4:].capitalize()
By the way if you have a very long expression, you can write it on several lines with the help of parentheses
     result = (foobarbazqux[100034:].capitalize() + x
                   + bazbarquxfoo[800:812].capitalize()
                   + quxbarfooqux("makdoland").upper())
Reply


Messages In This Thread
RE: Optimizing string capitalization challenge - by Gribouillis - Jan-01-2019, 05:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Team Chooser Challenge kanchiongspider 3 2,409 Jun-02-2020, 04:02 AM
Last Post: kanchiongspider
  Meal cost challenge Emekadavid 3 2,907 Jun-01-2020, 02:01 PM
Last Post: Emekadavid
  Appending To Files Challenge erfanakbari1 3 2,983 Mar-27-2019, 07:55 AM
Last Post: perfringo
  Problem with a basic if challenge erfanakbari1 2 2,025 Oct-12-2018, 08:04 AM
Last Post: erfanakbari1
  trying an online challenge tozqo 8 6,002 Jun-21-2017, 07:07 AM
Last Post: Kebap

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020