Tools, FAQ, Tutorials:
'int' Literals and Conversions
How to specify "int" values in Python code?
✍: FYIcenter.com
"int" values can be specified using "int" literals or
the int() conversion function as shown in this tutorial:
1. "int" literals in decimal digits as shown below:
>>> 1234 1234 >>> -1234 -1234 >>> 0 0
2. "int" literals in octal digits (prefixed with "0o") as shown below:
>>> 0o2322 1234 >>> -0o2322 -1234 >>> 0o0 0
3. "int" literals in hex digits (prefixed with "0x") as shown below:
>>> 0x4d2 1234 >>> -0x4d2 -1234 >>> -0x0 0
4. int() function converting other data types to "int":
>>> int(1234) 1234 >>> int("1234") 1234 >>> int(True) 1 >>> int(False) 0 >>> int(3.14159) 3 >>> int(3.64159) 3 >>> int(-3.64159) -3
⇒ 'float' Literals and Conversions
⇐ Python Built-in Primitive Data Types
2023-01-06, 1308🔥, 0💬
Popular Posts:
How to read RSS validation errors at w3.org? If your RSS feed has errors, the RSS validator at w3.or...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...
How to add images to my EPUB books Images can be added into book content using the XHTML "img" eleme...
What is EPUB 2.0 Metadata "dc:identifier" Element? EPUB 2.0 Metadata "dc:identifier" is a required m...