A list of hashtags and their lengths
Predict the output · Basic · §10.2 A building loop in one line
Predict the output without running the code.
Code
tags = ["python", "ai", "data"]
marked = ["#" + t for t in tags]
sizes = [len(t) for t in marked]
print(marked)
print(sizes, sum(sizes))Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.