Responsive Navbar with Google Search
☰ Menu
Home
Python
LaTeX
GNUPlot
Arduino
Feedback
Contact Us
Introduction to Python: Variable and Data Types
Introduction to Python
Print Function
Variable and Data Types
Mathematical Operations
Conditionals (if, elif, else)
For Loop
While Loop
User Defined Function
Module math and cmath
I/O Operation
Variable and Data Types: Program 1
'''Integer data type''' value = 10 if type(value) == int: print(f"{value} is an integer") else: print(f"{value} is not an integer") value = 10.12 if type(value) == int: print(f"{value} is an integer") else: print(f"{value} is not an integer")
Run Code
Output 1
Variable and Data Types: Program 2
'''float data type''' value = 74 if type(value) == float: print(f"{value} is a float") else: print(f"{value} is not a float") value = 510.12 if type(value) == float: print(f"{value} is a float") else: print(f"{value} is not a float")
Run Code
Output 2
Variable and Data Types: Program 3
#Assign variable value x = 5 y = 7 a, b, c = 4, 8.5, 2 str = 'python' print(f"x = {x}, y = {y}, a = {a}, b = {b}, c = {c}, str = {str}")
Run Code
Output 3