안녕하세요, 저는 모두 intro python 프로그래밍을하고 있으며 첫 번째 독립 코드를 수행하고 있습니다. 할당은 다음과 같다 : UnboundLocalError : 할당 전에 로컬 변수 'print'가 참조되었습니다.
그래서 내가 입력 :Prompt the user for his or her name. Then prompt the user for two numbers and then perform a mathematical operation of your choice on them. Make sure the program works with decimal numbers, and that you print a full equation in response, not just the result: Enter a number: 2.3 Enter another number: 3.6 2.3 – 3.6 = -1.3
def main1():
print("This is program 1!")
name = input("Please enter your name: ")
print("Pleased to meet you,", name ,"!") #next line def main2():
print("This is program 2!")
import math
number = input("Enter a number: ")
number = float(number)
numberr = input("Enter another number: ")
numberr = float(numberr)
print = ("number + numberr")
을 그리고 난이 점점 계속 :
UnboundLocalError: local variable 'print' referenced before assignment
도움말을!
가능한 중복 http://stackoverflow.com/questions/370357/python- variable-scope-error) –
Stack Overflow에서'UnboundLocalError'에 대해 _lot_ 개의 중복이 있습니다. 화면의 오른쪽에는 최소한 10 개가 표시되어야합니다. –