python-powerup/control_flow at master · suneel0101/python-powerup · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

README.md

Objective

  • get comfortable with if/else, for loops

Exercises

Problem 1:

Given x = "John Jameson",
- Construct an if else statement according to this logic: if "John" is in x, print "John is in x", otherwise print "John is not in x"
- Construct an if/elif/else statement according to this logic: if "roger" is in x, print "Hi Roger!", elif the length of x is greater than 20, print "thats a long string", else print "Oh well!"

Problem 2: - Construct a list of numbers between 0 and 1000 that are divisible by 33

Problem 3:

- Given the following list
["Donald Duck", "Mickey Mouse", "Daffy Duck", "Goofy", "Minnie Mouse", "Pluto"]
Get the sum of all of the lengths of these strings.
- Given the above list, create a list of all of the elements that have the letter "d" or the letter "m" in them