Python Program to initialize different datatypes and print
Program
a = 10
b = 20.25
c = 'a'
d = "John"
print("Integer type = ", a)
print("Floating point type = ", b)
print("Character type = ", c)
print("String type = ", d)
This program demonstrates how to initialize different data types in Python and print their values.
a = 10
b = 20.25
c = 'a'
d = "John"
-
Integer (
int):a = 10→ais an integer (whole number).
-
Floating-point (
float):b = 20.25→bis a floating-point number (decimal value).
-
Character (
strwith a single character):c = 'a'→cis a string containing a single character.
-
String (
str):d = "John"→dis a string (sequence of characters).
print("Integer type = ", a)
print("Floating point type = ", b)
print("Character type = ", c)
print("String type = ", d)
- The
print()function displays the values stored in each variable.
Output
Integer type = 10
Floating point type = 20.25
Character type = a
String type = John