-1
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')

That part simply does not work, and the deadline is today :(, why is that so and why cant I get it working, im getting a bit irritated :D

  • `input` returns a string and you try to compare the returned value `k` with a number. A string and a number will never be equal. BTW, please get rid of the superfluous parentheses. They make the code harder to read. `a = (1)` should be `a = 1` and `p = (v+0.02465)` should be `p = v + 0.02465`. – Matthias Apr 13 '21 at 07:01
  • I see, but there is a slight problem, I need someone to enter an answer number, and depending on the number it will display certain things. – Renārs Karlinskis Apr 13 '21 at 07:07

1 Answers1

0

input() return a string. Convert the string to an integer with 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=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')
tha
  • 56
  • 2
  • 9