I am trying to print the user input of a package name. I have the following code.
packageList = []
package = input("Enter name: ")
while package == '' :
print("Package name cannot be blank")
packagename = input("Enter name: ")
packageList.append(packageName)
print ((packageName) + "added")
I'm not sure what I'm doing wrong. An error is being displayed: UnboundLocalError: local variable 'packageName' referenced before assignment
packageNamevariable. Perhaps you meant forpackageandpackageNameto be the same variable, and mixed up which name you were using.packageList.append(packageName)should definitely not be in that loop.