Python: Printing different values (integer, float, string, Boolean)

Python: Printing different values (integer, float, string, Boolean)

In the given model, we are printing different values like integer, float, string and Boolean utilizing print() technique in python.

Program:

# printing integer value 
print(12)
# printing float value 
print(12.56)
# printing string value 
print("Hello")
# printing boolean value 
print(True)

Output:

Python: Printing different values (integer, float, string, Boolean)

Number juggling activities inside the print() on values:

# adding and printing integer value 
print(12+30)
# adding and printing float value 
print(12.56+12.45)
# adding and printing string value 
print("Hello"+"World")
# adding and printing boolean value 
print(True+False)

Output:

Python: Printing different values (integer, float, string, Boolean)

Printing different kinds of factors:

# variable with integer value
a=12
# variable with float value
b=12.56
# variable with string value
c="Hello"
# variable with Boolean value
d=True

# printing all variables 
print(a)
print(b)
print(c)
print(d)

Output:

Python: Printing different values (integer, float, string, Boolean)

Printing different kinds of factors alongside the messages:

# variable with integer value
a=12
# variable with float value
b=12.56
# variable with string value
c="Hello"
# variable with Boolean value
d=True

# printing values with messages 
print("Integer\t:",a)
print("Float\t:",b)
print("String\t:",c)
print("Boolean\t:",d)

Output:

Python: Printing different values (integer, float, string, Boolean)

Printing different kinds of factors with messages and changing over them to string utilizing “str()” work:

# variable with integer value
a=12
# variable with float value
b=12.56
# variable with string value
c="Hello"
# variable with Boolean value
d=True

# printing values with messages 
print("Integer\t:"+str(a))
print("Float\t:"+str(b))
print("String\t:"+str(c))
print("Boolean\t:"+str(d))

Output:

Python: Printing different values (integer, float, string, Boolean)

Leave a Comment

error: Alert: Content is protected!!