Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我的脚本不在if命令后打印;python;?_Python_If Statement - Fatal编程技术网

为什么我的脚本不在if命令后打印;python;?

为什么我的脚本不在if命令后打印;python;?,python,if-statement,Python,If Statement,这部分根本不起作用,截止日期是今天:(,为什么是这样,为什么我不能让它工作,我有点恼火:Dinput()返回一个字符串。将字符串转换为带int的整数: from forex_python.converter import CurrencyRates, CurrencyCodes c = CurrencyRates() minN = 5 maxN = 10 a = (1) b = (2) c = (3) d = (4) print('STOCKHOLDER') print('1. STOCKHOL

这部分根本不起作用,截止日期是今天:(,为什么是这样,为什么我不能让它工作,我有点恼火:D

input()
返回一个字符串。将字符串转换为带int的整数:

from forex_python.converter import CurrencyRates, CurrencyCodes
c = CurrencyRates()
minN = 5
maxN = 10
a = (1)
b = (2)
c = (3)
d = (4)
print('STOCKHOLDER')
print('1. STOCKHOLDER')
print('2.')
print('3.')
print('4.')
k=input()
if k == 1:
    print('PART that does not work')
    print(c.get_rate('EUR', 'USD',))
    v = (c.get_rate('EUR', 'USD',))
    print('STOCKHOLDER')
    p = (v+0.02465)
    o = (v+0.0978)
    i = (v+0.04325)
    print('STOCKHOLDER',p,'STOCKHOLDER',o,'un STOCKHOLDER',i,)
    print('STOCKHOLDER')

input
返回一个字符串,您尝试将返回值
k
与一个数字进行比较。字符串和数字永远不会相等。顺便说一句,请去掉多余的括号。它们使代码更难阅读。
a=(1)
应该是
a=1
p=(v+0.02465)
应该是
p=v+0.02465
。我明白了,但有一个小问题,我需要有人输入一个答案号码,根据号码它会显示某些内容。
from forex_python.converter import CurrencyRates, CurrencyCodes
c = CurrencyRates()
minN = 5
maxN = 10
a = (1)
b = (2)
c = (3)
d = (4)
print('STOCKHOLDER')
print('1. STOCKHOLDER')
print('2.')
print('3.')
print('4.')
k=int(input())
if k == 1:
    print('PART that does not work')
    print(c.get_rate('EUR', 'USD',))
    v = (c.get_rate('EUR', 'USD',))
    print('STOCKHOLDER')
    p = (v+0.02465)
    o = (v+0.0978)
    i = (v+0.04325)
    print('STOCKHOLDER',p,'STOCKHOLDER',o,'un STOCKHOLDER',i,)
    print('STOCKHOLDER')