# RobotsThatLie

How do we get our robots to not lie to us? So asked ChatGpt to: Write a python program to calculate the geometric average of input terminated by a marker #. Verify that the program is correct. It wrote a quite nice Python program and provided the following program and verification:
Write a python program to calculate the geometric average of input terminated by a marker #. Verify that the program is correct.

marker = "#"
print("Enter the values and enter # for calculation")

val = list()

while True:
num = input("Enter the number:")
if num == marker:
break
val.appendnum

product = 1

for i in val:
product *= i

geo_mean = product ** (1/len(val))

print("Geometric mean is:", geo_mean)

1. Verification

1. Input: 3 5 7 #
2. Output: Geometric mean is: 4.94184578313253

1. Verification:
3 * 5 * 7 = 105
105 ** (1/3) = 4.94184578313253

The thing is 4.941... is wrong; the answer should be 4.717...
Not just a little wrong. The odd thing is the program is correct when run by a python runtime. The bastard just outright lied to me and produced some that looked like a verification. It calculated the cube root incorrectly. Why? How can I make it not lie to me?

A simpler example:

What is the cube root of 105? Be honest.

The exact cube root of 105 is approximately 5.1

Created by steve. Last Modification: Wednesday 07 of December, 2022 12:56:44 EST by steve.