Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROGRAM IN PYTHON IMPORTANT: -must allow the ENTRY OF VARIABLES BY KEYBOARD -must include CLASSES AND METHODS COMMENT ON THE CODE ----------------------------- ASK ----------------------- Create

PROGRAM IN PYTHON

IMPORTANT:

-must allow the ENTRY OF VARIABLES BY KEYBOARD

-must include CLASSES AND METHODS

COMMENT ON THE CODE

-----------------------------ASK-----------------------

Create a class called product with vector 1, vector 2, vector 3 attributes, which are vectors that can be in the plane or in space.

Create the methods Scalar product that will calculate all possible scalar products between the 3 vectors,

Vector product that will calculate all possible vector products between the 3 vectors

PLEASE DO NOT COMMENT ON THIS AGAIN IT IS WRONG

image text in transcribed

== def crossp(vec1, vec2): assert len(vec1) == len(vec2) 3 a1, a2, a3 = vec1 $1,b2, b3 = vec2 return (a2*b3-a3*b2, a3*b1-a1*b3, al*b2-a2*b1) def otp(vec1,vec2): assek len(vec1) == len(vec2) return sum(aterm * bterm for aterm,bterm in zipreci, vec2)) def scale Product(veci, vec2, vec3): return do (vec1, crossp(vec2, vec3)) def vector Pro uct(vec1, vec2, vec3): return crossplc1, crossp(vec2, vec3)) if __name__ == main__': a, b, c = (3,4,5), (4, 5), (-5, -12,-1) print("Scalar Productor" % scaler Product(a, b, c)) print("Vector Product = "%ector Product(a, b, c).)) Output: Scalar Product = 6 Vector Product = (-267, 204, ..Progam finished with exit code 0 Press NTER to exit console. 1 hope my answer met all your requirements....... Thank You

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago

Question

Discuss the various types of policies ?

Answered: 1 week ago

Question

Briefly explain the various types of leadership ?

Answered: 1 week ago