Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # QUESTION 1 ------------------------------------------------
- # What is the value of `b`?
- a = [1, 2, 3, 4, 5]
- b = [x ** 2 for x in a]
- # QUESTION 2 ------------------------------------------------
- # What is the value of `c`?
- a = "Hello, World!"
- b = a.split()
- c = len(b)
- # QUESTION 3 ------------------------------------------------
- # What are the values of `a` and `b`?
- # What is the purpose of this method?
- def f(x):
- if x % 2 == 0:
- return True
- else:
- return False
- a = f(3)
- b = f(6)
- # QUESTION 4 ------------------------------------------------
- # What is the value of `a`?
- def f(x):
- if x == 0:
- return 0
- return f(x-1)
- a = f(3)
- # QUESTION 5 ------------------------------------------------
- # What is the value of `d`?
- a = """
- Hello
- from
- Red
- Hat
- """.split()
- b = [x for x in a if len(x) != 5]
- c = ["Thank you"] + b
- d = " ".join(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement