Python Quiz A
-
Write code to compute the tangent of $\pi/16$.
-
Make a variable called
tyger
that holds the text of the poem The Tyger by William Blake, in the exact form it is written. Usestrip
to remove extra whitespace at the start and end if you need to. -
Create a list with one item for each line in the
tyger
poem. -
Ask the human for a number. Print the line in The Tyger with that number and three more lines after that. It’s ok to just have an error when the number is 1000. The first line should be 1. Counting blank lines is ok.
-
Create a list containing the first 20 Pentagonal numbers. Print it.
-
Create a set containing the first 10,000 pentagonal numbers.
-
Create a set containing the first 10,000 perfect squares.
-
Create a set containing all of positive integers less than 100,000,000 that are both pentagonal and perfect squares. Print how many elements it has.
-
Create a dictionary with 20 elements that takes in the nth perfect square and puts out the nth pentagonal number.