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"
  1. Integer (int):

    • a = 10a is an integer (whole number).
  2. Floating-point (float):

    • b = 20.25b is a floating-point number (decimal value).
  3. Character (str with a single character):

    • c = 'a'c is a string containing a single character.
  4. String (str):

    • d = "John"d is 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