Calculate Shopping Cart Total

Level
Python
Syntax
Find the bug in the code above.
pymain.py — learnpython.today
pymain.py
1
from typing import List, Tuple
2
def calculate_total(items: List[Tuple[str, float, int]], tax_rate: float) -> float:
3
    total: float = 0.0
4
    for item_name, price, quantity in items:
5
        total += price * quantity
6
    # Now we need to return the total
7
    return

Mission Brief

A function must return its computed value. Identify the correct return statement in this shopping cart calculator.

Objective

Analyze the code snippet to your left. Identify the line containing the semantic or syntax error. Select the candidate that fixes it without introducing side effects.

Function
Syntax

© 2024 - 2025 LearnPython.Today. All rights reserved.

Redesigned and Collaborated for experience by MenteE