لَآ إِلَـٰهَ إِلَّا هُوَ
LA ILAHA ILLA HU
Allah, Your Lord There Is No Deity Except Him.

Lesson 5: Type Conversion In Python Coding

Type converion in python is used to convert from one type to another with the int(), float(), and complex() methods.

This process of converting the value of one data type (integer, string, float, etc.) to another data type is called type conversion.

Python Code For Type Conversion


out put will be

age enteredd plus 2

About This Code

Note that in the 1st line of code you are asking the user to input his age for instance it is 18 in this case is a int.

In the second line of code you are programming the system to add 2 to the age given by user.

Finally you are asking to print new age which is age entered by user + 2 the new age will be printed as old age + 2.

When You type or copy paste the above code in Python IDLE/Online Compiler/Editor, You will get the following output.

enter your old_age; the age entered by the user + 2

You can type/copy paste the above code in any online compiler or editor or you can even practice to write the code by hand.