QuestionQ66

VerifiedPython Basics

What output results from entering the following line of code in a Python interactive session?

>>> print (8 << 1)  
Explanation

In Python, shifting an integer left by one bit doubles its value. Thus, 8 << 1 evaluates to 16, which print displays.

Community Discussion

No comments yet. Be the first to start the discussion!