[Tutor] Python Calculator Help needed ASAP!!

Adam Eyring adameyring at gmail.com
Mon Sep 30 20:34:00 EDT 2019


A basic way to do this is to store the result of the first calculation in a
variable then use that variable when your reply to the first number of the
second equation is empty. An if statement will check for empty inputs and,
if true, use the result from the first equation.

On Mon, Sep 30, 2019, 7:55 PM Raj Patel <Raj_patel56 at hotmail.com> wrote:

> Hi so Im a university student new to python, and I’ve been given a mini
> assignment to create a calculate on python, on of the function it must have
> is that once the user has already calculated something and wants to
> recalculate something with that result the second time the input calls the
> result becomes one of the two nums
>
> Ex. Choose an operator: +
> Enter the first number: 56
> Enter the second number: 8
> Result: 64
>
> Choose an operator:+
> Enter the first number: (since I’d be leaving this blank the result from
> the last equation would become the number here)
> Enter the second number: 10
> Result: 74
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list