CBSE Class 9 Computer Applications Question 12 of 23

Introducing Python — Question 5

Back to all questions
5
Question

Question 3(iii)

What will be the output produced by following code fragment ?

side = int(raw_input('side'))	#side given as 7
area = side * side
print side, area
Answer
Output
7 49
Explanation
  1. side = int(input('side') ) ⇒ This statements asks the user to enter the side. We enter 7 as the value of side.
  2. area = side * side ⇒ area = 7 * 7 = 49.
  3. print (side, area) ⇒ prints the value of side and area as 7 and 49 respectively.