calculator

Calculator on Python

Calculator on Python Question: guys I’m just starting to learn python, and recently I tried to create my own kinda calculator. I wrote the code, and everything looks pretty fine to me, but for some reason I get the error ‘if math_multiply: NameError: name ‘math_multiply’ is not defined’. I get it whenever I try to …

Total answers: 3

How to go back again to an variable in python

How to go back again to an variable in python Question: the code below is just an example! I want to know after every options, it again return to gg Can anyone help me? gg=int(input(f""" [1] Age Calc [2] Name lenth [3] Calculator [4] {FORE.RED}Exit{FORE.RESET} Option: """)) d1 = dt.today() year = int(d1 .strftime("%Y")) if …

Total answers: 3

How to make a calculator function that uses the operator as an input?

How to make a calculator function that uses the operator as an input? Question: I started learning Python yesterday; this is the first calculator I’ve made. I noticed that the last lines of code that print the equation’s result are repeated. Can I write a function that takes the operator as input and then prints …

Total answers: 4

How can I run Python on my HP Prime graphing calculator?

How can I run Python on my HP Prime graphing calculator? Question: According to this firmware post, the HP Prime graphing calculator supports Python. However, I cannot find any guide as to how to run python files in the calculator (even within HP’s own 700 page long user manual). Does anyone know how to execute …

Total answers: 4

Assign a command to my Tkinter buttons by looping over them

Assign a command to my Tkinter buttons by looping over them Question: I would like to use a forloop to give my buttons a function in Tkinter. When I do it like this I get an error message, that those buttons are not defined. I tried several solution, but it did not work. I would …

Total answers: 2

NameError : name "a" is not defined

NameError : name "a" is not defined Question: I have made a simple calculator.py program in Python, but the program fails with NameError: "a" is not defined. How can I fix it? import math def control(a, x, y, z, k): return { ‘ADDITION’: addition(x, y), ‘SUBTRACTION’: subtraction(x, y), ‘MULTIPLICATION’: multiplication(x, y), ‘DIVISION’: division(x, y), ‘MOD’: …

Total answers: 2

Python Calculator: Several options, changing the number

Python Calculator: Several options, changing the number Question: Hello I am new to python and I am trying to do an assignment but I couldn’t get the needed output I am supposed to get. Can any one suggest me what I am missing? Thank you! Assignment: The last exercise in this chapter continues with the …

Total answers: 1