Py Warmup 2
-
A list of the first 20 Fibonacci numbers. So $[1,1,2,3,5,\ldots]$.
-
A list with the partial sums of the first 20 perfect fourth powers. So $[1^4, 1^4+2^4, 1^4+2^4+3^4, …]$.
-
Write a function
some_words
that takes in a list of stringssomeWords
and outputs a list of the strings insomeWords
that come after “grapefruit” in the dictionary and have at least 5 letters.someWords ["apple","mango","papaya","blueberry","juju"] == ["mango","papaya"]
-
(Function:
q4
) Ask the person to type a number, useinput()
. Print 20 times that number. -
(Function:
numpair
) Given a string containing some integers separated by spaces, output a list of pairs (number, position), where position is the index of the number in the list - counting from zero.numpair "10 50 30 70" == [(10,0), (50,1), (30,2), (70,3)]
-
(Function:
largeRem
) Given two integers, output the one with the largest remainder when divided by 1397.largeRem 2000 2800 == 2000
-
(Function:
myConcat
) Given two lists, return the list made by joining all of the items from each, in order.myConcat [3,1,2] [50,60,70,80] == [3,1,2,50,60,70,80]
-
(Function:
lastPrint
) Given a list of positive integers, modify the list by repeatedly removing the last item and printing it. Stop after you hit a four digit integer. Return the modified list. -
Make a deque with 10000 random integers in the range [-500,800]. Remove numbers from the start of the list stopping after you hit a number above 700. Add in 1000 more random numbers at the start.
-
Create a list containing all of the Pythagorean triples $(a,b,c)$ with $a<100$ and $b<100$.
-
Remove the duplicates from your list, so you end up with $a < b < c$. Sort them based on $a$ and then $b$.
Alternative
USACO bucket list problem: 2018 December Bronze 2.