livepython.net

142. Python Program to Rename Unclear Variables

EasyNaming

Overview

Good names make code explain itself. Here, every name is a single letter, and two of them are capitals.

Problem Statement

The starter code works out the cost of some tickets, but its names say nothing. Rename every variable:

  • to a clear name that says what it stores,
  • in snake_case: small letters, words joined by _,
  • in every place it's used, not only where it's created.

The output must stay exactly the same.

The tests check only the output, and the starter code already prints it. So they can't see your names: read your code once more and ask "would someone else understand every name?"

Input

No input is required for this question.

Output

Rocky bought 4 tickets
Total cost: 600

Learn this firstChapter 16 · Python Naming Conventions: snake_case, UPPER_CASE and More
solution.py
a = "Rocky"
B = 4
C = 150
d = B * C
print(a, "bought", B, "tickets")
print("Total cost:", d)

EXPECTED OUTPUT

1Rocky bought 4 tickets
2Total cost: 600

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.