nerdexam
Python_Institute

PCEP-30-02 · Question #383

What is the expected output of the following code? ``python menu = {"pizza": 2.39, "pasta": 1.99, "folpetti": 3.99} for value in menu: print(str(value)[0], end="") ``

The correct answer is B. ppt. See the full explanation below for the reasoning.

Question

What is the expected output of the following code?
menu = {"pizza": 2.39, "pasta": 1.99, "folpetti": 3.99}
for value in menu:
 print(str(value)[0], end="")

Options

  • AThe code is erroneous and cannot be run.
  • Bppt
  • C213
  • Dpizzapastafolpetti

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    84% (21)
  • C
    8% (2)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice