🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: First API Call: all 10 questions

Quiz: First API Call · Question 7 of 10

What does this print? (code)

What does this print?

price_in, price_out = 2.00, 10.00          # USD per million tokens
input_tokens, output_tokens = 10_000, 1_000
usd = input_tokens / 1e6 * price_in + output_tokens / 1e6 * price_out
print(round(usd, 4))
  1. A.0.012
  2. B.0.3
  3. C.0.03
  4. D.12.0
Answer & explanation

Correct answer: 0.03

0.02 dollars for input plus 0.01 dollars for output.

Can you get the rest right without peeking?

Take the timed Quiz: First API Call quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →