xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create different data type variables in Python
Python Online Editor
Execute Code
More Python Sample Codes
# Declare and initialize variables of different data types # Note: str() method is used to convert integer, decimal, float, double and boolen data types to string char_variable = 'A' # Character data print(char_variable + " is a character data") # Output: A is a character data string_variable = "Hello C#" # String data print(string_variable + " is a string data") # Output: Hello C# is a string data integer_variable = 10 # Integer data print(str(integer_variable) + " is an integer data") # Output: 10 is an integer data float_variable = 3.14 # Single-precision floating-point data print(str(float_variable) + " is a float data") # Output: 3.14 is a float data complex_variable = 2 + 3j # complex data print(str(complex_variable) + " is a double data") # Output: 2.71828 is a double data bool_variable = True # Boolean data print(str(bool_variable) + " is a boolean data") # Output: True is a boolean data