Reputation: 3
Because I want to make user know what numbers he is inputting. I want to display it like this
for i in range(0,5):
V[i]=int(input("Masukkan V ke ",i))
U[i]=int(input("Masukkan V ke ",i))
It doesnt work. Because it doesn't want argument outside of ".." Is there an alternative way to code it or not?
Upvotes: 0
Views: 55
Reputation: 32997
Yes, you could cast to str
then concatenate:
... input("Masukkan V ke " + str(i))
Or use print
instead:
print("Masukkan V ke", i, end='')
... input()
Or use str.format
or printf
-style formatting:
... input("Masukkan V ke {}".format(i))
... input("Masukkan V ke %s" % i)
Upvotes: 1