python函数def录入输入值_Def函数python:原始输入不是s

我是python的新手。从2013年开始在大学学习以来,我一直在努力学习以了解python的工作原理。抱歉,如果有点乱。在

让我在下面展示我的问题。

我有一些def函数,看起来像:def thread_1():

a = input('Value UTS (100) = ')

if a > 100:

print line2

d=raw_input('Dont higher than 100. Input y to repeat : ')

d='y'

if d=='y' :

thread_1()

return a

def thread_2():

b = input('Value UAS (100) = ')

if b > 100:

print line2

d=raw_input('Dont higher than 100. Input y to repeat : ')

d='y'

if d=='y' :

thread_2()

return b

def thread_3():

c = input('Value Course (100) = ')

if c > 100:

print line2

d=raw_input('Dont higher than 100. Input y to repeat : ')

d='y'

if d=='y' :

thread_3()

def thread_4():

value_total = a*50/100+b*30/100+c*20/100

这是我的表达式在程序列表中的定义

^{pr2}$

最后,我运行这个程序:

只要我输入的数字是好的,但在最后程序显示的错误代码是那样的:Traceback (most recent call last): File "ganjil-genap.py", line 71, in

thread_4() File "ganjil-genap.py", line 36, in thread_4

value_total = a*50/100+b*30/100+c*20/100 NameError: global name 'a' is not defined

谁能告诉我我做错了什么吗?在

提前谢谢。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值