def intro():
print("This program computes payroll based on")
print("over time rate of ", overTime, " after ", workWeek, " hours")
name = input("Enter employees name: ")
hours = (int(input("Enter hours worked: ")))
rate = input("Enter rate: ")
答案 0 :(得分:1)
虽然它被认为是一种不好的做法,但在大多数情况下你应该避免使用全局变量,你可以使用" global"在函数内部到达变量。
像这样:
global name
name = input("string")