โขprint function,which writes to standard out. Standard out is where the computer writes its output.
โขStrings or characters are enclosed in inverted commas.
print(โhello worldโ)
โขOutput of above statement.
hello world
โขTo print out multiple items, you can provide them separated by commas. You can put strings and numbers in a print function.
print(โmyโ,โprogram no.โ,1)
Output of the above statement, Python inserted a space between them.
my program no. 1
Below statement will output the value you assigned to your variables(variable1 and A)
variable1=10
A=5
print(variable1, A)
Output of the above statement
10 5
To output multiple string variables we can use + operator:
B=โHelloโ
C=โWorldโ
print(B+C)
Output of the above statement
HelloWorld
In case of integer or float variables + operator will give sum of values stored in variables, as shown below:
B=5
C=10
print(B+C)
Output of the above statement
15
Leave a Reply