Preview:
print("Hello, World!")

####################################

if 5 > 2:
  print("Five is greater than two!")
  
  

if 5 > 2:
  print("Five is greater than two!")

##################################

x = 5
y = "Hello, World!"

print(x)
print(y)

#This is a single line comment

"""
This is a comment
written in
more than just one line
"""

#################################

x = 5
y = "John"
print(x)
print(y)

##############################

x = 4       # x is of type int
x = "Sally" # x is now of type str
print(x)

#############################

x = str(3)    # x will be '3'
y = int(3)    # y will be 3
z = float(3)  # z will be 3.0

print(x)
print(y)
print(z)

############################

x = 5
y = "John"
print(type(x))
print(type(y))

############################

x = "John"
# is the same as
y = 'John'

print(x)
print(y)

###########################

a = 4
A = "Sally"
#A will not overwrite a

print(a)
print(A)

#########################

myvar = "John"
my_var = "John"
_my_var = "John"
myVar = "John"
MYVAR = "John"
myvar2 = "John"

print(myvar)
print(my_var)
print(_my_var)
print(myVar)
print(MYVAR)
print(myvar2)

########################


x = "My name is Sadman + Samin = SadManSamIN. What is that you intend to do?"
print(x)

############################

#Multi word variable name case

myVariableName = "Camel"
MyVariableName = "Pascal"
my_variable_name = "Snake"

print(myVariableName) 
print(MyVariableName)
print(my_variable_name)

#############################

#Multiple variables at once.

x, y, z = "I", "am", "Sam"
print(x)
print(y)
print(z)
 
"""
 we can use print command in the same line using
 comma(,) like this.
"""
 
print(x), print(y)

#####################

#Assigning same value to multiple variables at once.

x = y = z = "My_Variable"
print(z)
print(y)
print(x)

####################

#Unpacking collection

Fruits = ["Orange", "Apple", "Anhilation"]

x, y, z = Fruits
print(x)
print(y)
print(z)

#Packing tuple

fruits = ("Apple", "Orange", "Cherry")
print(fruits)

#Unpacking tuple
(green, yellow, red) = fruits
print(green)
print(yellow)
print(red)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter