Print Statements
Print Statements
You can print statement 10 time 100 time as you wish
just type 10* or 100* or Your number *
Print(10*"Hello World")
You can print statement 10 time 100 time as you wish
just type 10* or 100* or Your number *
Print(10*"Hello World")
In programming, data type is an important concept.
Variables can store data of different types, and different types can do different things.
Python has the following data types built-in by default, in these categories:
Text Type: | str |
Numeric Types: | int , float , complex |
Sequence Types: | list , tuple , range |
Mapping Type: | dict |
Set Types: | set , frozenset |
Boolean Type: | bool |
Binary Types: | bytes , bytearray , memoryview |
You can get the data type of any object by using the type()
function:
Print the data type of the variable x:
x = 5
print(type(x))
In Python, the data type is set when you assign a value to a variable:
Example | Data Type | Try it |
---|---|---|
x = "Hello World" | str | |
x = 20 | int | |
x = 20.5 | float | |
x = 1j | complex | |
x = ["apple", "banana", "cherry"] | list | |
x = ("apple", "banana", "cherry") | tuple | |
x = range(6) | range | |
x = {"name" : "John", "age" : 36} | dict | |
x = {"apple", "banana", "cherry"} | set | |
x = frozenset({"apple", "banana", "cherry"}) | frozenset | |
x = True | bool | |
x = b"Hello" | bytes | |
x = bytearray(5) | bytearray | |
x = memoryview(bytes(5)) |
#Legal variable names:
myvar = "John"
my_var = "John"
_my_var = "John"
myVar = "John"
MYVAR = "John"
myvar2 = "John"
#Illegal variable names:
2myvar = "John"
my-var = "John"
my var = "John"
Variables are containers for storing data values.
Unlike other programming languages, Python has no command for declaring a variable.
A variable is created the moment you first assign a value to it.
x = 5
y = "John"
print(x)
print(y)
Indentation refers to the spaces at the beginning of a code line.
Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.
Python uses indentation to indicate a block of code.
if 5 > 2:
print("Five is greater than two!")
How to print in python :
print("Hello World")
how You can Comment in python programme :
Use # Before comment
and for multiline comment use :
"""
This is multi
line
command
"""
Python
Python is a programming language.
Python can be used on a server to create web applications.
:
Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.
It is used for: