final print statement.  When I plugged in print(2**3) or 2^3, the result was 8, which is accurate. When I did the same with print(2//3), the result was zero. Isn't // the same as **, to the power of? I don't understand why the double slashes resulted in a different answer

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 17SA
icon
Related questions
Question

Hi, I am working on a problem in beginner's Python and wanted to make sure I was explaining the results properly. I also had a question about my final print statement.  When I plugged in print(2**3) or 2^3, the result was 8, which is accurate. When I did the same with print(2//3), the result was zero. Isn't // the same as **, to the power of? I don't understand why the double slashes resulted in a different answer. I attached my work below. 

 

IDLE Shell 3.9.6
File
Edit Shell Debug Options Window Help
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21)
[MSC v.1929 64 bit (AMD64) ] on win32
Type "help", "copyright", "credits" or "license ()" for more information.
>>>
>>> #CITA 180
>>> #Execute the following statements
- Module 1
Problem l
>>>
>>> #Print Hello World!
>>> print ("Hello", "World!")
Hello World!
>>>
>>> #Print 3.0
>>> print (3.0)
3.0
>>>
>>> #Add 2.0 + 3.0
>>> print (2.0 + 3.0)
5.0
>>>
>>> #Print number 2 first and number 3 second
>>> print ( "2" + "3")
23
>>>
>>> #Print 2 + 3 = 5
>>> print ("2+3="
• 2+3)
2+3= 5
>>>
>>> #Print 2 to the power of 3
>>> print (2**3)
8.
>>>
>>> #Print 2 divided by 3
>>> print (2/3)
0.6666666666666666
>>>
>>> #Print 2 to the power of 3
>>> print (2//3)
>>>
Transcribed Image Text:IDLE Shell 3.9.6 File Edit Shell Debug Options Window Help Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64) ] on win32 Type "help", "copyright", "credits" or "license ()" for more information. >>> >>> #CITA 180 >>> #Execute the following statements - Module 1 Problem l >>> >>> #Print Hello World! >>> print ("Hello", "World!") Hello World! >>> >>> #Print 3.0 >>> print (3.0) 3.0 >>> >>> #Add 2.0 + 3.0 >>> print (2.0 + 3.0) 5.0 >>> >>> #Print number 2 first and number 3 second >>> print ( "2" + "3") 23 >>> >>> #Print 2 + 3 = 5 >>> print ("2+3=" • 2+3) 2+3= 5 >>> >>> #Print 2 to the power of 3 >>> print (2**3) 8. >>> >>> #Print 2 divided by 3 >>> print (2/3) 0.6666666666666666 >>> >>> #Print 2 to the power of 3 >>> print (2//3) >>>
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning