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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education