# A: int type
# 1, action:
# 2, the definition:
# Age = 10 # Age = int (10)
# name (parameter)
# Print ( 'Hello', 'World')
# X = int (10)
# INPUT = name ( 'XXX')
# Print RES = ( 'XXX') # no product (return value)
# Print (RES)
# 2, cast
# 2.1 converted into a string of digital-int
# RES = int ( ' 100111 ')
# Print (RES, type (RES))
# 2.2 (Learn)
# 2.2.1 other binary converted into decimal
# 10 hex -> binary
# 11 -> 1011
# 1011-> 8 + 2 + 1
# Print (bin (11)) # 0b1011
# 10 hex -> octal
# Print (the OCT (11)) # 0o13
# 10 hex -> hex
# Print (hex (11)) # 0xb
# Print (hex (123)) 0xb #
# 2.2.2 other turn made into its decimal
# binary -> 10 hexadecimal
# print (int ( '0b1011' ,2)) # 11
# Binary -> octal
Print # (int ( '0o13',. 8)). 11 #
# Binary -> 16 hexadecimal
# Print (int ( '0xb', 16)). 11 #
#. 3, using
# two: float type
# 1 and effect
# 2 definition
# salary = 3.1 # salary = float (3.1)
# 3, type conversion
# RES = float ( "3.1")
# Print (RES, of the type (RES))
# 4, using
# int and float there is no need to have built-in method
# their use is relatively math operations +
Numeric type (int, float)
Guess you like
Origin www.cnblogs.com/h1227/p/12455637.html
Recommended
Ranking