LearnFrenzy
Sign in Take a free test

Python Basics and Syntax · Predict the Output · Question 6

Several statements on one line Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

What is the output of the following Python program?

main.py
a = 7; b = 2; print(a // b, a / b, a % b)
  • A 3.5 3.5 1
  • B 3 3.5 1 Correct
  • C 3 3 1
  • D 3 3.5 0.5
Correct Answer: Option B

// is floor division (3), / always gives a float (3.5) and % is the remainder (1).

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links