Lab 12: Conditionals and List Comprehension
Practice list comprehensions! Create list comprehensions that generate the following:
- A list of powers of 2 up to 2**100
- A list of the square roots of each number 1-20
- Generated using the previous list, a list of the squares of the numbers in the list from question 2. This will give you the squares of the square roots of each number 1-20
- Read in the lines from a file (file_lines = open("filename").readlines()), and generate a list of the lengths of each line in the file. Use any text file you like. If you're looking for one and you're on Linux, try /etc/resolv.conf
- A list of 10 random decimal numbers between 0 and 5