top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Basic Calculator Application

A simple calculator made using if else condition that performs 5 basic mathematic operation between two numbers( addition, subtraction, multiplication, division and modulus operation).

Firstly calculator function is defined with flag initialized as zero and user input a 7. This flag value allows user to exit while loop and the function itself.



Then the user is allowed to choose which operation they want to perform which is shown as in the code snippet below. Try catch block is added to ensure that no only integer is entered by the user.





If the user input is not in the desired range we exit from the loop and the function as flag is set to 1 . Also if the an non integer is input the user input value will be default 7 which leads to user input being out of range.

Else the two numbers are to be input by user on which the desired mathematical operation is to be performed . The try catch block is added to ensure floating point numbers are input by user.


Finally based on the user input choice desired mathematical operation is performed through if conditions.



In this way a simple calculator application is defined an executed by calling the calculator function.

The entire code is and an output instance are as follow:







 
 
 

1 comentário


Data Insight
Data Insight
20 de set. de 2021

Very good! You shouldn't embed codes using images. You should use the code snippet functionality instead.

Curtir

COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page