"""
========================================
Introduction to Computer Programming
========================================
-----------------------------------------------
Programming Assignment 1
strings and definite loops
(YOUR NAME)
Name of partner (if any) on initial part of Lab 1: ...
Number of exercises completed on Lab 1 during lab itself: ...
Two homework problems (12-18) you are highlighting: ...
... status ...
-----------------------------------------------
"""
# ------------------------ remaining LAB 1 exercises ---------------------
...
# ---------------------- addition homework problems ----------------------
# 12.
def arrow(s):
"""
Returns a string that is like s, but with an arrow in front of it as in:
>>> arrow('computer science')
'--> computer science'
"""
t = ...
return t
# 13.
def quote(s):
"""
Returns a string that is like s, but surrounded by double quotes.
>>> quote('whatever')
'"whatever"'
"""
...
return ...
# 14.
def big_cool(m):
"""
Returns the string 'cool' glued together m times, with an exclamation point
at the end.
>>> big_cool(3)
'coolcoolcool!'
"""
...
return ...
# 15.
def big_two(m):
"""
Returns result of repeatedly squaring a number, starting with 2, m times,
as in this sequence:
2 (just 2)
4 (2 squared)
16 (4 squared)
256 (16 squared)
and so on.
>>> big_two(1)
4
>>> big_two(3)
256
>>> big_two(6)
18446744073709551616
"""
...
return ...
# 16.
def extended_mask(s):
"""
Returns a string consisting only of stars ('*') and has length that is one
more than twice the length of s.
>>> extended_mask('')
'*'
>>> extended_mask('$5')
'*****'
>>> extended_mask('loop')
'*********'
"""
...
return ...
# 17.
def sum3n1(n):
"""
Returns the sum of the first n numbers in the sequence:
1, 4, 13, 40, 121, ...
(each successive term is one more than three times the previous term)
>>> sum3n1(0)
0
>>> sum3n1(1)
1
>>> sum3n1(3) # 1 + 4 + 13
18
>>> sum3n1(6) # 1 + 4 + 13 + 40 + 121 + 364
543
"""
...
return ...
# 18.
def diamond(n):
"""
Returns a diamond-shape string consisting of: spaces, '*' and newline
symbols and so that each line of the string consists of zero or more
spaces, and zero or more stars (and a newline) and first the number of
stars increases as 1, 3, 5, etc. and then decreases back down to 1. This
lets us print diamond-shape patterns like this:
>>> print(diamond(1))
*
>>> print(diamond(2))
*
***
*
>>> print(diamond(3))
*
***
*****
***
*
"""
...
return ...