Skip to content

Files

Latest commit

 

History

History

011-Calculator(Beginner)

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Calculator Project

Topics Covered:

  1. Recursion
  2. Difference between print and return
  3. DOC Strings

1. Recursion

Recursion is a programming technique where a function calls itself in order to solve a problem. It's like when you're solving a big puzzle, and you break it into smaller puzzles of the same type to solve them individually. Each time you solve a smaller puzzle, you're closer to solving the big one.

2. Difference between print and return

In programming, print is like showing your work to someone, while return is like giving an answer. When you print, you're just displaying information on the screen, but when you return, you're sending a value back to where the function was called from, like giving an answer to a question.

3. DOC Strings

DOC Strings are like little notes you write to yourself and others to explain what your code does. They help you understand your code better and make it easier for others to use it. It's like writing instructions for a game so that anyone can play it without getting confused.

Sample Output



 _____________________
|  _________________  |
| | Pythonista   0. | |  .----------------.  .----------------.  .----------------.  .----------------. 
| |_________________| | | .--------------. || .--------------. || .--------------. || .--------------. |
|  ___ ___ ___   ___  | | |     ______   | || |      __      | || |   _____      | || |     ______   | |
| | 7 | 8 | 9 | | + | | | |   .' ___  |  | || |     /  \     | || |  |_   _|     | || |   .' ___  |  | |
| |___|___|___| |___| | | |  / .'   \_|  | || |    / /\ \    | || |    | |       | || |  / .'   \_|  | |
| | 4 | 5 | 6 | | - | | | |  | |         | || |   / ____ \   | || |    | |   _   | || |  | |         | |
| |___|___|___| |___| | | |  \ `.___.'\  | || | _/ /    \ \_ | || |   _| |__/ |  | || |  \ `.___.'\  | |
| | 1 | 2 | 3 | | x | | | |   `._____.'  | || ||____|  |____|| || |  |________|  | || |   `._____.'  | |
| |___|___|___| |___| | | |              | || |              | || |              | || |              | |
| | . | 0 | = | | / | | | '--------------' || '--------------' || '--------------' || '--------------' |
| |___|___|___| |___| |  '----------------'  '----------------'  '----------------'  '----------------' 
|_____________________|

What's the first number? 10
+
-
*
/
Pick an operation:/
What's the next number? 5
10.0 / 5.0 = 2.0

'Y' ---> To calculate with 2.0.
'N' ---> To start from Starting.
'E' ---> To exit.
ENTER HERE ---> y
Pick an operation:*
What's the next number? 5
2.0 * 5.0 = 10.0

'Y' ---> To calculate with 10.0.
'N' ---> To start from Starting.
'E' ---> To exit.
ENTER HERE ---> e
Thank You for using Yethsihwar's Calculator.