# Python Calculator Demo

##### Lesson Details:
July 10, 2020

I: Introduction

Introduction to programming languages

A programming language is a formal language that is used for computer programming. Programming languages are used to create programs that give users the ability to solve problems in a structured way. There are different types of programming languages, but one of the most widely used types is the imperative language. Imperative languages are used to describe actions. An example of this type of language is Python. Python is an imperative language that is commonly used for general-purpose programming.

I: Body

Python calculator demo

To demonstrate the use of an imperative language, this paper will present a Python calculator demo. First, open up the terminal and type python3 to enter the Python interpreter. To see the possible commands available in the interpreter, type help() or ?. To run a program, type python3 filename (with correct extension). If no extension is specified, the interpreter assumes .py. The following Python calculator demo shows how to use basic calculations with Python.

#include int main(int argc, char *argv[]) { int num1; int num2; int res; printf("Enter first number: "); scanf("%i", #1); printf("Enter second number: "); scanf("%i", #2); res = num1 + num2; printf("The sum is %i", res); return 0; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include int main ( int argc , char * argv [ ] ) { int num1 ; int num2 ; int res ; printf ( "Enter first number : " ) ; scanf ( "%i" , & num1 ) ; printf ( "Enter second number : " ) ; scanf ( "%i" , & num2 ) ; res = num1 + num2 ; printf ( "The sum is %i" , res ) ; return 0 ; }

When run, the program will prompt for two numbers and then return the sum.

II: Conclusion

Conclusion