Casting in Python

Share Your Love

Casting is applied in python to specify the type of data directed to a variable. This is done to increase the accuracy and make the variable more appropriate in terms of holding values.

Some of they ways of casting are as follows:

  • int() to hold integer value provided as input
  • float() to hold float value provided as input
  • str() to hold string value provided as input

let us see some examples to get the ways cleared,

Input for int:


em9cCQJDa5LLUquY7ELlGkebNVSz 6fU2y2UM6dHDEP6 gy1DRirIWWGA3j8go CfGKv8j xhXJtKxRXTL3PRzG3AdqH64rmoZUyQTKaxOFqFwjckNGdk 5uLuTbYcqG N3New

Input for float:


zOiOMnxEe btSgOilHmCnqzdSBi6iKbpU9RjNoNydu3 CWt3p4553jVop48k9ijM1alwq2V9bBLe267c3MhORIUva2hKnKxYaM 1MEK76gKQIV X2CpxBq6CusN6Bw1FPVUl A

Input for string:
x=str("Lingaraj Techhub")


LpAUwhwoskMCQVPOQXf10 o GiS86

Here we come to the end of the topic of discussion on casting in C, hope we were able to clear all your doubts.

Please share and write comments on this post and wants to improve WhatsApp us.

Share Your Love
Avatar photo
Soham Malakar

Hello my name is Soham Malakar am currently pursuing BCA

Coding is one of my favorite hobbies.
I love to code and an enthusiast to learn different types of programming languages.
I love to get intoxicated in the world of technology and video games.
A quick learner possessing better results.

Articles: 40

Newsletter Updates

Enter your email address below to subscribe to our newsletter