Skip to content
Worked Examples · Example 5.13

Q.Example 5.13:
x = 4 #assignment statement
cube = x ** 3 #assignment statement
print (x, cube) #print statement
4 64

Uttarakhand UbseTextbookSubjective· 2mImportance★★★★★est
49% · 24/49 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Two assignment statements build x = 4 and cube = 4³ = 64; print(x, cube) then displays "4 64" — values separated by print's default single space.

The concept is the anatomy of an assignment statement: Python always evaluates the expression on the right of = first, then binds the resulting object to the name on the left. A statement, unlike an expression typed at the prompt, displays nothing by itself — which is why a print() is needed to see the values.

>>> x = 4           # assignment statement
>>> cube = x ** 3   # assignment statement
>>> print(x, cube)  # print statement
4 64

Trace:

StepStatementWhat happensxcube
1x = 44 is bound to the name x4—
2cube = x ** 3right side evaluated: 4 ** 3 = 64; result bound to cube464
3print(x, cube)prints the two values, separated by one space464

Output:

4 64

Details worth noting: …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.