June 2018
Intermediate to advanced
294 pages
7h 5m
English
Variables are used in Python and in other programming languages to store temporary values in memory in order to reuse them in multiple places in the source code.
We have various types of variables in Python, as shown in the following list:
At any stage in your source code, you can cast from one variable to another using the following type casting syntaxes:
# A string type port numberport_number = "80"# An integer, which holds the number of hostshost_count = 254# Convert port number into integer typeint(port_number)# Convert port number into a float type with decimalsfloat(port_number)# Convert the number of host into a stringstr(host_count)
Read now
Unlock full access