Page 134 - TP_Prime_v2.2_Class_6
P. 134
To correct this program, we will have to define the numbers as integer values. Let us look
at the program below:
Prime (Ver. 2.2)-VI In the above program, the int( ) function is used to change the data type from string to
Using int() Function
integer.
Similarly, to use, float, we will need to change the data type from string to float:
X= float(input(“enter any number”)).
132
The type( ) Function
The type() function in Python is used to determine the data type of a given value. It returns
the class type of the input, allowing you to check what kind of data type is being used. This
is useful when you're unsure of the type of a value or variable.
Let us see an example:
Using type( ) Function
Fun The type( ) function recognises “quotation” marks for string values. If
Fact! an integer value is written in quotation marks, it will consider the type as
String.
Variables in Python
In Python, variables are like containers used to store data. They hold values that we might
need later in our program. When we want to use the stored values, we can simply refer to
the variable's name to get the data back.

