Python – Basic Python Programing
Python’s syntax is straightforward and resembles that of English. Python boasts a syntax that makes it possible for programmers to write programs in less lines than some other languages. Python is an interpreter-based programming language, which means that code can be run immediately upon writing. Prototyping can therefore be completed relatively quickly.
Python – How to Add two numbers using + Operator
Python Code :
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> Number1 = 5 >>> Number2 = 10 >>> sum = Number1 + Number2 >>> print("sum of", Number1, "and", Number2, "is", sum) sum of 5 and 10 is 15 >>>
Python – How to Subtract two numbers using “-” Operator
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> Number1 = 10 >>> Number2 = 5 >>> Subtract = Number1 - Number2 >>> print("Subtract of", number1, "and", Number2, "is", Subtract) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'number1' is not defined. Did you mean: 'Number1'? >>> print("Subtract of", Number1, "and", Number2, "is", Subtract) Subtract of 10 and 5 is 5 >>>
Please read this as well if you enjoy this article.