Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python_int_function_example

Snippet info

Language

Python

Visibility

public

Author

masterhun

Created

2023-10-06T22:35:12.366021Z

Updated

2024-08-15T23:46:40.987034Z



print("Python built-in function: int(value, base)")


value = "0001"

base = 2 

decimal = int(value, base)

print(f"If the digits are {value} and the base is {base}, then the decimal number is {decimal}.")


# value = "1010"

base = 8 

decimal = int(value, base)

print(f"If the digits are {value} and the base is {base}, then the decimal number is {decimal}.")



# value = "1010"

base = 16 

decimal = int(value, base)

print(f"If the digits are {value} and the base is {base}, then the decimal number is {decimal}.")
INFO