Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to create a python script and need a little help. Im trying to write

ID: 3782664 • Letter: I

Question

I am trying to create a python script and need a little help.

Im trying to write a program that will take 3 inputs and store in a text file. Input one will be a song title, two will be its highest place on the charts and three will be band memebrs and their instruments.

The output Im trying to get is <song name, hights place on charts, [member,instrument], [member2,instrumnet]..........> I want to do this for as many songs as I want to enter, and then be able to print all that data from the txt file.

Explanation / Answer

#you might get intendation error in your system. correct it according to your ide.
entering=true
while(entering):
   name = input("Song Name?")
chart = input("hights place on charts")
addmember=true
mem = [] #member list, to add required number of member.
while(addmember):
   member=input("enter member");
       instrument=input("enter instrument");
       mein=member+instrument;
       mem.append(mein) #appending members in list.
       moremembers=input("press 1 to stop adding members")
       if moremembers==1:
           addmember=false
fd = open("songsfile.txt","w")
fd.write(name)
fd.write(' ')
fd.write(chart)
fd.write(' ')
fd.write(' '.join(mem))
fd.close()
moresongs=input("press 1 to stop adding songs")
if moresongs==1:
       addmember=false
      
      

f = open("songsfile.txt","r")
contents = f.read()
f.close()

print contents
          

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote