Title here
Summary here
Our first translation will focus on constant values. Here is the full source code in Python.
import math
# const declares a constant value.
S = "constant"
def main():
print(S)
# A const statement can appear anywhere a var statement can.
N = 500000000
# Constant expressions perform arithmetic with arbitrary precision.
D = 3e20 / N
print(D)
# A numeric constant has no type until it’s given one, such as by an explicit conversion.
print(int(D))
# A number can be given a type by using it in a context that requires one,
# such as a variable assignment or function call. For example, here math.sin expects a float.
print(math.sin(N))
if __name__ == "__main__":
main()
To run the program, save the code in a file named constants.py
and use the python
interpreter to execute it.
$ python constants.py
constant
6e+11
600000000000
-0.28470407323754404
Now that we can run and understand basic Python programs using constants, let’s learn more about the language.