Support Forums

Full Version: NameError: name 'Main' is not defined
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my code, simple I know, just learning:

# temptable.py
# This program displays a table of celsius and farenheit temps from 0 to 100
# Written by: Chris Watson

def main():
print("This programs show celsius and fahrenheit temps from 0 to 100")
for celsius in [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]:
fahrenheit = 9/5 * celsius + 32
print (celsius, fahrenheit)
Main()

Here is my result and error:

>>> import temptable
0 32.0
10 50.0
20 68.0
30 86.0
40 104.0
50 122.0
60 140.0
70 158.0
80 176.0
90 194.0
100 212.0
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import temptable
File ".\temptable.py", line 10, in <module>
Main()
NameError: name 'Main' is not defined

I can't figure out why it is saying that Main is not defined. It does this in everything I try to write. Please help. Thanks in advance.