The YOLO Challenge

yoloThe YOLO challenge consists of creating an acronym generator: a program that prompts the user to enter an expression or a sentence (e.g. “You only live once!”) and in return gives the acronym matching the user input (e.g. “YOLO”)

Learning Objectives


In this challenge you will further improve your string manipulation techniques and your use of lists in Python. You will investigate how to split a string into a list and how to iterate through each item of a list.

Tips

  • First you may investigate the split() method that can be used on any string:
  • You may also look at the upper() and lower() method that can be used to convert a string to UPPERCASE or lowercase.
    For instance:
    myStr.upper() would convert the myStr string to uppercase.
  • To access specific characters of a string using their position you can use the following notation:myStr[0] (This would return the first character of a string called myStr).
  • Finally to iterate through all the values in a list, you may need to use a for loop:

Your Turn


Use all of the above tips to complete the YOLO challenge:

Challenge #2


You may want to fine tune your code so that words like “the” or “a” are being ignored.

Share Button
Posted in Computer Science, Python - Beginner, Python Challenges Tagged with: ,

Our Latest Book

Follow this blog