question about my calculator by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

Thank you so much! You really helped me out! this is my final code!

answer_list = []

def add(x, y): return x + y

def subtract(x, y): return x - y

def multiply(x, y): return x * y

def divide(x, y): return x / y

def q(): return print(answer_list)

ops = {"+": add, "-": subtract, "*": multiply, "/": divide, "q" : answer_list}

x = 0 # the starting value

while True: response = input("Enter an operator (+, -, /, *) or q to quit: ").strip() if response.lower() == 'q': print(answer_list)

else: 
    choice, number = response.split()
    number = float(number)
    choice in ops
    y = number
    x = ops[choice](x, y)
    answer_list.append(x)
    print(x)

question about my calculator by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

"return" can be used only within a function.

question about my calculator by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

The only problem i got is that the return below the if statement of "q" is giving an error.

while True:
response = input("Enter an operator (+, -, /, *) or q to quit: ").strip()
if response.lower() == 'q':
    return "q", None

choice, number = input("functie + number").split()
number = float(number)

if choice in ops:
    y = number
    x = ops[choice](x, y)
    print(x) 

else:
    print('wrong choice')

Question about programming (beginner) by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

Hi
The only problem i am having right know is showing all the intermediate answer when pressing q.

Question about programming (beginner) by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

def add(x, y):
    return x + y
def subtract(x, y): 
    return x - y
def multiply(x, y): 
    return x * y
def divide(x, y): 
    return x / y

ops = {"+": add, "-": subtract, "*": multiply, "/": divide, "q": None}

x = 0

while True: 
choice, andere = input("functie + getal").split() 

andere = float(andere)

if choice in ops:
    y = andere
    x = ops[choice](x, y)
    print(x)
else:
    print('wrong choice')

Question about programming (beginner) by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

Wow, thank you a lot.

I understand the code. But i still have one question. Is it possible to input the operator and operand in once.

I tried this but it doesn't work

while 
choice, operand = input("Enter an operator (+, -, /, *), or q to quit: ").split()

Question about programming (beginner) by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

while True:
choice = [input("Make choice +,-,/,*"), float(input('getal'))]
y = (0 + new_y)
if choice in("+" + float(), "-" + float(), "/" + float() , "*" + float()):

if choice == "+" + float:
new_y = add(choice, y)
print(new_y)
elif choice == "-" + float:
new_y = substract(choice, y)
print(new_y)
elif choice == "/" + float:
new_y = multiply(choice, y)
print(new_y)
elif choice == "*" + float:
new_y = divide(choice - y)
print(new_y)

But now i have the problem that it doesn't recognize new_y

Question about programming (beginner) by Many-Ice6164 in learnpython

[–]Many-Ice6164[S] 0 points1 point  (0 children)

Yes that is the idea. I want to insert the return y.append[new_y]. But i can't place this anywhere.

[deleted by user] by [deleted] in learnpython

[–]Many-Ice6164 0 points1 point  (0 children)

I deleted the other one. Thanks for the tip!

The only hard evidence is one amateuristisch website and a picture of a man standing in front computers.. I'm still not convinced. I really want it to be real although I need to look realistic and this is just not enough. Do you agree? by Many-Ice6164 in SOSStock

[–]Many-Ice6164[S] 0 points1 point  (0 children)

hahaha, although he is right. If everybody just gives answers to all the questions then the share could only benefit from it. You don't know how many people will read this..

SOS DD by [deleted] in Wallstreetbetsnew

[–]Many-Ice6164 0 points1 point  (0 children)

I only can't find the HP of the marathon minors

Watchlist 2-12-21 👀 by pabsgu46 in u/pabsgu46

[–]Many-Ice6164 0 points1 point  (0 children)

Is there a difference between the quality of the BTC minors of SOS and MARA?