Categories
Easy Problems

โจทย์เขียนโปรแกรมข้อ VZ0060

จงเขียนฟังก์ชั่นเพื่อให้ค่า determinant (ad-bc)ของ matrix 2*2 โดยค่าที่ป้อนเข้าคือ a,b,c,d แทน matrix

[[a, b], [c, d]]

Examples
calcDeterminant([
[1, 2],
[3, 4]
]) ➞ -2

calcDeterminant([
[5, 3],
[3, 1]
]) ➞ -4

calcDeterminant([
[1, 1],
[1, 1]
]) ➞ 0

เฉลย ด้วยภาษา Python

Leave a Reply