Program:
Output:
#Type casting #1. string to int x=input("Enter value of x:") print(x,type(x)) y=int(x) print(y,type(y)) #2. int to string a=10 print(a,type(a)) b=str(a) print(b,type(b)) #3. int to float m=20 print(m,type(m)) n=float(m) print(n,type(n)) #4. float to int p=4.5 print(p,type(p)) q=int(p) print(q,type(q)) #5. int to bool x=256 print(x,type(x)) y=bool(x) print(y,type(y))
Output: