Share your repls and programming experiences

← Back to all posts
Calculator 2.0
James193 (13)

After many hours of work its finished!!!!
it can do:
Square root
Vector length
Line slopes

Codemonkey51 (1049)

Cool, I tried the calculator part of this project before, and I have one suggestion, have it make it an in line so instead of this:

Number 1 --> 1
Sign --> +
Number --> 1
You want to calculate 1+1.
The result is 2.

It shows this:

Equation --> 1 + 1
You want to calculate 1+1.
The result is 2.

To achieve this you can replace:

num1 = int(input("Number 1 --> "))
sign = input("Sign --> ")
num2 = int(input("Last number --> "))

with this:

equation = input("equation --> ")
equation = equation.split(" ")
num1 = equation[0]
sign = equation[1]
num2 = equation[2]
James193 (13)

Thank you very much!!!
This is much better now !!!

XanthusPettitt (7)

hey im trying to code a calculator for vectors, how did you figure out how to calculate the vectors

James193 (13)

@XanthusPettitt I started by doing a bitof research, then making a test repl I just tried doing different ways to calculate vectos and vector lenghts. First it takes the coordinates e.g (5,6) which is done in this line and then outputing it.
x, y = input("x and y coordinate: ").split()
print("Your vector is (%s, %s)" % (x, y))
Then the next line
length = sqrt(int(x)2) + sqrt(int(y)2)
is calculating the length by adding them together which is the lenght of the vector, for 5 6 it would be 11.
Sorry if its not much help as it was a year ago and im a bit rusty on these sort of things now and I dont code as much cause life lol!

James193 (13)

@XanthusPettitt I would recommend just experimenting and researching. You can use my code to base yours off of. But if you just want to use mine thats fine, just link to here if you do! Have fun!

XanthusPettitt (7)

@James193 ok james becasuse the formula sheet im using is no help so thank you for explaining

James193 (13)

@XanthusPettitt no worries, happy to help, youtube is the best place to go, this is a good video explaing it :)