简体   繁体   中英

What does this mean in Python?

I'm learning Python.

I'm curious to know what this mean?

count = 10**6

I try to print the variable "count" but gives me an error.

Can someone give me a clue on this?

Best Regards,

在这种情况下, **

** is the exponentiation operator, so you are computing 10 to the 6th power. The Python documentation tabulates the supported operators.

It sounds like you might be using Python 3, but are using a tutorial designed for Python 2. In Python 3, print() is a function and requires parentheses:

print(count)

In Python 2, print is a statement and can be used without parentheses:

print count

As always, it would help us if you show the actual error you are getting.

** means exponentiation. Usually that is represented by ^.

In the above example 10**6 will give you a result of 1000000

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM