Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep getting a global name not defined error

def defineType(riskCode):
    if riskCode == 1:
        riskType = High
    else:
        if riskCode == 2:
            riskType = Moderate
        else:
            if riskCode == 3:
                riskType = Low
            else:
                if RiskCode == 4:
                    riskType = No

This is part of a program I'm working on for a class...

# Global Variables
custName = input('Please enter your name: ')
custAge = int(input('Please enter your age: '))
custViolation = int(input('Please enter the number of violations: '))

riskCode = 0
estimatePrice = 0
riskType = none

These are my global variable...

Traceback (most recent call last):
  File "C:\Users\Alli\Downloads\HwyRobbery.py", line 13, in <module>
    riskType = none
NameError: name 'none' is not defined

This is the error that I keep getting with different variations depending on what changes I make to try to solve the problem

Any help would be greatly appreciated!!!

Thanks! Alli

like image 953
Alli OGrady Avatar asked Jul 01 '26 08:07

Alli OGrady


1 Answers

It's None not none. Python is case sensitive.

like image 88
Mark Ransom Avatar answered Jul 03 '26 00:07

Mark Ransom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!