Lesson 1 – Challenge Questions

Here are a few challenges that you should be able to complete based on the knowledge you have currently.

Challenge 1.1


Write a function that takes a text string (i.e. text_var = "Hello World") prints it back out with a border above and below it.


  • You need to count the number of characters in a string, use the len(text_var) function
  • Use the equal sign (=) for the border
  • The function should create the same number of = characters as the number of characters in the string


Here are a few examples:

border_text("Hello World") # will return
Hello World

border_text("Hello Mike") # will return
Hello Mike

border_text("Hello") # will return

Challenge 1.2


Write a set of Python statements that can find the length of each side of this right triangle.


Given the following:

  • Angle C is 90 degrees
  • Angle B is 54 degrees
  • Side a has a length of 4 inches


  • Use the Math library
  • Use basic Trigonometry (if you need help, ask)
  • You will probably need to convert degrees to radians (there’s a function for that)

Challenge 1.3


Create and print Pascal’s triangle by showing 10 levels. Have each level’s list in one big list (i.e. pascals_triangle = [[1], [1, 1], [1, 2, 1], [etc.]]). You cannot just write [1,3,3,1] in your code, you must find it through an algorithm.

You can append a list after you have created it. For example,

pascals_triangle = [[1]]



Pascal's Triangle


pascals_triangle[0] # Should return
pascals_triangle[1] # Should return
[1, 1]
pascals_triangle[2] # Should return
[1, 2, 1]

# All the way to
pascals_triangle[9] # Should return
[1, 9, 36, 84, 126, 126, 84, 36, 9, 1]