Get a nvim distribution like lazy or lunar or nvchad, etc and install obsidian.nvim.
- 1 Post
- 8 Comments
Joined 6 months ago
Cake day: December 26th, 2024
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
palmtrees2309@lemm.eeto Programming@programming.dev•Why is my output not formatted as a string?English3·4 months agoAfter the split x becomes (1 and z becomes 1). They can’t be converted to float. I think that’s why. Let me run the code. Edit - Also as you are returning a, b, c from splitter but Python functions return a single object. The a, b, c turns to a tuple. But you are using js syntax I think. So we have to unwrap inside the calculate function.
Now my original comment is not useful but you can try to introduce a conditional to check of the numbers x and z are actually numbers before converting to floats
# Ask user to enter an expression and display output def main(): expression = input("Expression: ") print(calculate (splitter (expression))) # Split expression into components and assign to variables as float values def splitter (expression): print(expression) x, y, z = expression.split() print(expression.split()) return x, y, z # Calculate expression result # Changes Beginning def calculate(numbers): x,y,z = numbers # Changes End x, z = float(x), float(z) if y == "+": return str(round((x + z), 1)) elif y == "-": return str(round((xz), 1)) elif y == "*": return str(round((x*z), 1)) else: return str(round((x / z), 1)) main()
palmtrees2309@lemm.eeOPto Programming@programming.dev•I have created my Portfolio site as a computer underGrad. Please rate / roast it.English2·4 months agoI knew that so coordinate are for my college not my residence
palmtrees2309@lemm.eeOPto Programming@programming.dev•I have created my Portfolio site as a computer underGrad. Please rate / roast it.English9·4 months agoSorry I will work on it. Thank you
I thought this was about police being a lap dog for the elite
I am 80% done with my bachelors of Technology in Computer Science and Engineering in India. Never had a issue.