Regarding looping inclusion | Sololearn: Learn to code for FREE!

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.

10/23/2018 4:48:29 PM

Mohinish Teja

1 Answer

New Answer

+4

#Do you need something like this? for i in range(int(input('How many times?\n'))): s.read() s.display()