0

Regarding looping inclusion

class Book: def __init__(self): self.title="" self.author="" self.price=0 def read(self): m=input("Enter Title name=") self.title+=m n=input("Enter Author name=") self.author+=n o=int(input("Enter price=")) self.price+=o def display(self): print("Title=",self.title) print("Author=",self.author) print("Price=",self.price) s=Book() s.read() s.display() ''''''''''''''''''''''''''''''''''''''''''''' I want to ask the user how many number of books he want to enter.My program just results in 1 input.I need multiple inputs from user.So,I need to run a loop.So,please help me in running loop for read function.

23rd Oct 2018, 4:48 PM
Mohinish Teja
1 Odpowiedź
+ 4
#Do you need something like this? for i in range(int(input('How many times?\n'))): s.read() s.display()
23rd Oct 2018, 5:25 PM
Mert Yazıcı
Mert Yazıcı - avatar