+ 1
I wrote a program to print strationary item that accepts the product and price and print it. But it's not working y?
n=input() x=[] y=[] for i in range(0,n): a=input("enter the item no",i+1) b=int(input()) x.append(a) y.append(b) for i in range (0,n): print("{}.{} - ₹{}".format(i,x[i],y[i]))
21 ответ
+ 3
n=int(input())
x,y=[],[]
for i in range(0,n):
a=input("enter the item")
b=int(input("enter the price"))
x.append(a)
y.append(b)
for i in range(0,n):
print("{}.{} - ₹{}".format(i+1,x[i],y[i]))
+ 3
You can't pass more than 1 arguments in input() function. And also change "n" to int for loop to run
+ 3
n=int(input())
Also
input can't contain two arguments ,remove that ",I+1" from a=input("enter the item no",I+1)
+ 1
Thats not how it works. 3 people just told you the answer, figure it out. If you still have trouble, you may want to read that bit again
+ 1
Inputs should be
3
Apple
30
Orange
40
Grapes
50
0
Whats the expected output? And whats the error? It seems fine exept for the ",i+1" part where you take input for the variable 'a'.
0
Plz correct it and answer me
0
U didnt get the price from the user
0
Out put should be apple - Rs 30
Orange - Rs 40 like that
0
Input is as u said...
0
No u didnt get the price?!
0
And it's showing track back error
0
Tq I corrected myself
0
Here Is The Solution Of Your Query :
https://code.sololearn.com/cm490OxX5c5A/?ref=app
0
Vicky Try this. This will work fine. It won't work as you expect in Sololearn's editor. Try it on any other editor.
n = int(input())
x, y = [], []
for i in range(0,n):
print("Enter the product name.")
a = input()
print("Enter the price.")
b = int(input()) #or typecast to float
x.append(a)
y.append(b)
for i in range (0,n):
print("{}. {} - ₹{}".format(i+1,x[i],y[i]))
- 1
Sss