25
loading...
This website collects cookies to deliver better user experience
print('Hello World')
120 + 80
50 - 20
30 * 2
12 / 2
12 // 2
3 ** 2
11 % 3
'He\'s a good boy'
.\n
at the point after which you want to start a new line. input('Please enter a value: ')
'Hello' + 'World'
'HelloWorld'
printed on your console.'Hello'*3
will result in 'HelloHelloHello'
.a = 100
print(a)
to print the value of variable a in the console.age = 21
age = age + 1
age+=1
age+=1
has same effect as age=age+1
. The +=
removes the need to repeat the variable name twice in the line totally.
We can also use the subtract and multiplication operator instead of the addition operator to update the subtracted or multiplied value of the variable like age-=2
and age*=4
. The former will reduce the value of the age variable by 2 and the latter will multiply it by 4.