Recent questions tagged goclasses-da-dpp-day-190

1 1 vote
2 2 answers
177
177 views
Consider the following Python code:nums = [1, 2, 3, 4, 5] result = [n * 2 if n % 2 == 0 else n + 1 for n in nums if n 2] print(result)What is the output of the code abov...
0 0 votes
1 1 answer
126
126 views
Consider the following Python code:text = "bookkeeper" count = 0 for i in range(len(text) - 1): if text[i] == text[i + 1]: count += 1 print(count)What is the output of th...
0 0 votes
1 1 answer
121
121 views
Consider the following Python code:def update(nums): nums.append(nums[-1] + 1) nums = nums[1:] nums[0] = 99 return nums values = [3, 4, 5] result = update(values) print(v...
1 1 vote
1 1 answer
121
121 views
Consider the following Python code:data = {"a": 2, "b": 3} for key in ["a", "c", "b", "a"]: data[key] = data.get(key, 0) + 1 print(data)What is the output of the code abo...
0 0 votes
1 1 answer
122
122 views
Consider the following Python code:items = [10, 20, 30, 40, 50] part = items[1:4] part = 99 items += part[0] print(items, part)What is the output of the code above?[10,...
To see more, click for the full list of questions or popular tags.