xxxxxxxxxx
pythonCopyvar1 = 123
var2 = 'World'
print("Hello to the",var2,var1)
xxxxxxxxxx
#First name your variable. You can name the variable anything you want. I will name my variable "Fact".
fact = ("Grepper is good")
#You can see that after I named my variable I put the text I wanted to print in parenthasees and quotations. That is the text that will print.
print(fact)
#I told it to print my variable, Fact, because the text I wanna print, "Grepper is good", is equal to my variable, Fact. So, when I click run/start, it should print "Grepper is good".
#Feel free to use this code and edit it to your liking. Hope this helped!
xxxxxxxxxx
>>> print("{:d} {:03d} {:>20f}".format(1, 2, 1.1))
1 002 1.100000
^^^
0's padded to 2
xxxxxxxxxx
x = input("Enter the first number: ")
y = input("Enter the second number: ")
z = int(x)+int(y)
#Just use a comma
print("The sum of the numbers you entered =",z)
xxxxxxxxxx
#How to print a variable the code below sets a variable to Hello, World!
variable = "Hello, World!"
#Use the print function to write out anything (the name variable after the print function is the name of the variable you want to print)
print(variable)
xxxxxxxxxx
#HOW TO PRINT A VARIABLE.
name = 'Wizard'
print(name)
#IT'LL PRINT THE VERY VARIABLE "name"
xxxxxxxxxx
print "If there was a birth every 7 seconds, there would be: {} births".format(births)