answersLogoWhite

0

An example might be:

firstNumber = raw_input("Enter your first number: ")

secondNumber = raw_input("Enter your second number: ")

operatorChoice = raw_input("What do you wish to do with these numbers? ")

if operatorChoice == "-":

subtractSum = firstNumber - secondNumber

print("Here is your result: %s") % (str(subtractSum))

if operatorChoice == "+":

additionSum = firstNumber + secondNumber

print("Here is your result: %s") % (str(additionSum))

That's a basic example.

User Avatar

Wiki User

8y ago

What else can I help you with?

Related Questions

Code to develop a calculator in adobe flex?

here is the code for simple calculator in flex,[Bindable] private var _txt:Object;[Bindable] private var _choos:String;private function satu():void{txtLayar.text = txtLayar.text + '1';}private function dot():void{txtLayar.text = txtLayar.text + '.';}private function dua():void{txtLayar.text = txtLayar.text + '2';}private function tiga():void{txtLayar.text = txtLayar.text + '3';}private function empat():void{txtLayar.text = txtLayar.text + '4';}private function lima():void{txtLayar.text = txtLayar.text + '5';}private function enam():void{txtLayar.text = txtLayar.text + '6';}private function tujuh():void{txtLayar.text = txtLayar.text + '7';}private function lapan():void{txtLayar.text = txtLayar.text + '8';}private function sembilan():void{txtLayar.text = txtLayar.text + '9';}private function noll():void{txtLayar.text = txtLayar.text + '0';}private function clear():void{txtLayar.text = '';}private function sum():void{_txt = txtLayar.text;_choos = '1';txtLayar.text = '';}private function sub():void{_txt = txtLayar.text;_choos = '2';txtLayar.text = '';}private function mul():void{_txt = txtLayar.text;_choos = '3';txtLayar.text = '';}private function div():void{_txt = txtLayar.text;_choos = '4';txtLayar.text = '';}private function hasil():void{var txt2:Number = Number(txtLayar.text);var txt3:Number = Number(_txt);var has:Number;if(_choos=='1'){has = txt3 + txt2;}else if(_choos == '2'){has = txt3 - txt2;}else if(_choos == '3'){has = txt3 * txt2;}else if(_choos == '4'){has = txt3 / txt2;}txtLayar.text = has.toString();}]]>


Can you run a python program using code Can you give me the code I need to use in order for it to work I am using codio plz help?

Assuming you only intend executing your code on your own machine and you have some version of Python installed, you can execute a Python script from within your code in the same way you can execute a Python script via the command line: python script.py infile outfile -o


Can you delete code on python?

you can uninstall it just like any other program.


What is the python code for drawing a circle?

circle(radius)


What is the source code for scientific calculator in c?

What is the source code for scientific calculator in c?Read more: What_is_the_source_code_for_scientific_calculator_in_c


How to use pycharm community edition for python programming?

Creating and Running a Python File in PyCharm Step 1: Create a New Project. On the Welcome screen, select New Project. ... Step 2: Create a New Python Script. If you're greeted by the main.py file when the project opens, you're ready to start coding in Python. ... Step 3: Write Some Python Code. ... Step 4: Run Your Python Code.


What is pep 8?

PEP 8, or Python Enhancement Proposal 8, is a style guide for Python code that provides conventions for writing clean and readable code. It covers various aspects of coding style, including naming conventions, code layout, indentation, and comments. Adhering to PEP 8 helps improve code consistency and maintainability, making it easier for developers to collaborate on Python projects. It is widely accepted as the standard style guide in the Python community.


Download code for scientific calculator in java?

yes


Can you do Python coding on an iPad?

Sorry, but not that I know of. Python is only available on Mac OS or Windows. You would also need a code editor which is only on a PC.


Why doesn't this Python code do what it's supposed to do - see Discussion?

Ask on Stack Overflow. Wiki Answers is not for pasting code


What mean python IDE?

A Python IDE (Integrated Development Environment) is a software application that provides comprehensive facilities to programmers for software development in Python. It typically includes a code editor, debugging tools, a console, and project management features to streamline the coding process. Popular Python IDEs include PyCharm, Visual Studio Code, and Jupyter Notebook, each offering different features to enhance productivity and ease of use for Python developers.


What is the bonus code for iron man 3?

The bonus code for Iron Man 3 is: mark 20 python. However, you also can use other codes for bonuses, such as the words "striker missile".