- print( ) : print a message in Python.
| Code cell | Output |
|---|---|
| print(“This is my first programme!”) | This is my first programme! |
| print(“who are u “) | who are u |
2. Arithmetic : Aaddition, subtraction, multiplication, or division
| calculations with python! | Code cell | Output |
|---|---|---|
| Addition | print(5 + 3) | 8 |
| Subtraction | print(5 – 3) | 2 |
| Multiplication | print(5 * 2) | 10 |
| Division | print(12 / 2) | 6 |
| Exponent | print(3 ** 2) | 9 |
| (2(1+3)(9−2))2 |
3. Comments
| Code cell | Output |
|---|---|
| # This is my first programme to add 5 + 6 print(5 + 6 ) | 11 |
4. Variables
| Code cell | Output |
|---|---|
| #Create a variable Fruit_Price and then put its value 12+120 Fruit_Price=20+120 #Print value of Fruit_price Print(fruit_price) | 120 |
| #changing the variable value Mango_price=120 Print(Mango_price) Mango_price=100 Print(Mango_price) Mango_price=80 Print(Mango_price) | 120 100 80 |
| Pen_price=10 Pen_price=10+2 Print(pen_price) | 12 |
| Code cell | Output |
|---|---|
| #first Create variables Milk_Price= 60 Per_day_sell_in_L = 50 Nos_of_day_in_year = 365.6 # Calculate Total Sell per year in Rs. Total_Sell = Milk_Price * Per_day_sell_in_L * Nos_of_day_in_year print(Total_Sell) | 11 |