0
I need help in python today
I need a calculator for 3D vectors where i can input the numbers and choose the operation and it should have returns on every single error like "the numbers dont match" and stuff like that i reaaly need help i only have like 7hr left to do the assignment
13 Respuestas
+ 1
If you want to build a tool, you first need a specification. Or did you mean you want to use someone else tool?
+ 1
Hi! So it seems like you have to make the tool in Python. The you have to start to with your linear algebra book, to find out what you want to solve with your Python script. Then you have to think of how to do that in Python. When you know what you want, start coding, and if you stuck, you ask for help here with your code linked, and with your question about your problem. /Regard Per B 🙂
+ 1
Great! A starting point! It is much better you opened the Playground in SoloLearn an put the code there, and then liked it here. It will be more easy to peaple to run it when the trying to help you. /Per B
0
I have tried other peoples codes in python but i need a specific code wher it asks u to write the dimensions of the vectors and after that asks u to chose the operation like "*" "+" "-" "/" and if something doesnt work properly it should return text like example: v1(1,4,5) / v2 (7) cant be divided or smthing like that
0
Do you have any self written piece of code for this task?
0
Tbh i just took someone elses code my first lecturer at university didnt know what to do soo now im on the second course of python with another lecturer and im kinda stuck
0
class Vector3D:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
#adding two vectors
def __add__(self, other):
return Vector3D(self.x + other.x, self.y + other.y, self.z + other.z)
#subtracting two vectors
def __sub__(self, other):
return Vector3D(self.x - other.x, self.y - other.y, self.z - other.z)
#dot product
def dot(self, other):
return (self.x*other.x + self.y*other.y+self.z*other.z)
#cross product
def cross(self,other):
return Vector3D(self.y*other.z - self.z*other.y, self.z*other.x-self.x*other.z, self.x*other.y-self.y*other.x)
#insert your wanted vector coordinates
first = Vector3D(5, 7, 2)
second = Vector3D(3, 9, 3)
result_add = first + second
print ("Vectors added")
print(result_add.x)
print(result_add.y)
print(result_add.z)
print()
result_subtract = first - second
print ("Vectors subtracted")
print(result_subtract.x)
print(result_subtract.y)
print(result_subtract.z)
print()
print("dot
0
So i want the console to ask me to input the cector coordinates on the first and the second vector line and i want it to ask me which operation i want to use and print i dont want it to print all of them at once plus theres no division here and no multiplier
0
I really like python in general but my teacher tought us less and demanded more so i didnt have great grades or dont know much so thats why i need help sry for the waste of time i know it should be easy and its basic but i dont have much time
0
Hi! It seems like you already have have a code you can use. But if you want to add som functions, only you can take that picture you have in your mind and make it to a detailed text where you that you can translate to a Python code. That is a condtion to make it possible to code it. So begin set up a specification wgat you want the code to do.
0
Using mathploth library to do 3D vectors
- 1
So can u help me??