SlideShare a Scribd company logo
1 of 2
Download to read offline
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 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.
Solution
# i provided this solution earlier it had indentaion problem, not this solution is working perfectly
fine.
#=======code=================
#you might get intendation error in your system.
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=int(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=int(input("press 1 to stop adding songs"))
if moresongs==1:
entering=False
f = open("songsfile.txt","r")
contents = f.read()
f.close()
print (contents)

More Related Content

Similar to I am trying to create a python script and need a little help.Im tr.pdf

PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
Yashpatel821746
 
Hello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdfHello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdf
mohamednihalshahru
 
I need help writing a python 3 function- I need to write a function th.docx
I need help writing a python 3 function- I need to write a function th.docxI need help writing a python 3 function- I need to write a function th.docx
I need help writing a python 3 function- I need to write a function th.docx
patriciab30
 
Questions4
Questions4Questions4
Questions4
hccit
 
Need help with this java code. fill in lines where needed. Also, not.pdf
Need help with this java code. fill in lines where needed. Also, not.pdfNeed help with this java code. fill in lines where needed. Also, not.pdf
Need help with this java code. fill in lines where needed. Also, not.pdf
rishabjain5053
 
UNIT III PYTHON.pptx python basic ppt ppt
UNIT III PYTHON.pptx python basic ppt pptUNIT III PYTHON.pptx python basic ppt ppt
UNIT III PYTHON.pptx python basic ppt ppt
SuganthiDPSGRKCW
 

Similar to I am trying to create a python script and need a little help.Im tr.pdf (18)

Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
 
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
 
Hello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdfHello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdf
 
I need help writing a python 3 function- I need to write a function th.docx
I need help writing a python 3 function- I need to write a function th.docxI need help writing a python 3 function- I need to write a function th.docx
I need help writing a python 3 function- I need to write a function th.docx
 
Pa1 flow chart
Pa1 flow chartPa1 flow chart
Pa1 flow chart
 
File handling in pythan.pptx
File handling in pythan.pptxFile handling in pythan.pptx
File handling in pythan.pptx
 
Questions4
Questions4Questions4
Questions4
 
Python
PythonPython
Python
 
Python Traning presentation
Python Traning presentationPython Traning presentation
Python Traning presentation
 
Need help with this java code. fill in lines where needed. Also, not.pdf
Need help with this java code. fill in lines where needed. Also, not.pdfNeed help with this java code. fill in lines where needed. Also, not.pdf
Need help with this java code. fill in lines where needed. Also, not.pdf
 
Aspects of software naturalness through the generation of IdentifierNames
Aspects of software naturalness through the generation of IdentifierNamesAspects of software naturalness through the generation of IdentifierNames
Aspects of software naturalness through the generation of IdentifierNames
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdf
 
AmI 2015 - Python basics
AmI 2015 - Python basicsAmI 2015 - Python basics
AmI 2015 - Python basics
 
Class 5: If, while & lists
Class 5: If, while & listsClass 5: If, while & lists
Class 5: If, while & lists
 
UNIT III PYTHON.pptx python basic ppt ppt
UNIT III PYTHON.pptx python basic ppt pptUNIT III PYTHON.pptx python basic ppt ppt
UNIT III PYTHON.pptx python basic ppt ppt
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
 
Python introduction
Python introductionPython introduction
Python introduction
 
Python course Day 1
Python course Day 1Python course Day 1
Python course Day 1
 

More from arumugambags

C++ Write a function which prompts the user for a number and return.pdf
C++ Write a function which prompts the user for a number and return.pdfC++ Write a function which prompts the user for a number and return.pdf
C++ Write a function which prompts the user for a number and return.pdf
arumugambags
 
Any ideas why this isnt being recognized as a class. Its conside.pdf
Any ideas why this isnt being recognized as a class. Its conside.pdfAny ideas why this isnt being recognized as a class. Its conside.pdf
Any ideas why this isnt being recognized as a class. Its conside.pdf
arumugambags
 
actice edF sophy i does As a Make perspective, the HR perspective, .pdf
actice edF sophy i does As a Make perspective, the HR perspective, .pdfactice edF sophy i does As a Make perspective, the HR perspective, .pdf
actice edF sophy i does As a Make perspective, the HR perspective, .pdf
arumugambags
 
What questions are descriptive studies designed to answerSoluti.pdf
What questions are descriptive studies designed to answerSoluti.pdfWhat questions are descriptive studies designed to answerSoluti.pdf
What questions are descriptive studies designed to answerSoluti.pdf
arumugambags
 
The firm is Tesla Motors1.Based on information in the annual repor.pdf
The firm is Tesla Motors1.Based on information in the annual repor.pdfThe firm is Tesla Motors1.Based on information in the annual repor.pdf
The firm is Tesla Motors1.Based on information in the annual repor.pdf
arumugambags
 

More from arumugambags (20)

Case 2-A Work–Life Balance Answer the following questions at the bo.pdf
Case 2-A Work–Life Balance Answer the following questions at the bo.pdfCase 2-A Work–Life Balance Answer the following questions at the bo.pdf
Case 2-A Work–Life Balance Answer the following questions at the bo.pdf
 
C++ Write a function which prompts the user for a number and return.pdf
C++ Write a function which prompts the user for a number and return.pdfC++ Write a function which prompts the user for a number and return.pdf
C++ Write a function which prompts the user for a number and return.pdf
 
Any ideas why this isnt being recognized as a class. Its conside.pdf
Any ideas why this isnt being recognized as a class. Its conside.pdfAny ideas why this isnt being recognized as a class. Its conside.pdf
Any ideas why this isnt being recognized as a class. Its conside.pdf
 
actice edF sophy i does As a Make perspective, the HR perspective, .pdf
actice edF sophy i does As a Make perspective, the HR perspective, .pdfactice edF sophy i does As a Make perspective, the HR perspective, .pdf
actice edF sophy i does As a Make perspective, the HR perspective, .pdf
 
why is it important in everyday life to monitor water levels in orga.pdf
why is it important in everyday life to monitor water levels in orga.pdfwhy is it important in everyday life to monitor water levels in orga.pdf
why is it important in everyday life to monitor water levels in orga.pdf
 
Which system performs better using OFDM to service two different us.pdf
Which system performs better using OFDM to service two different us.pdfWhich system performs better using OFDM to service two different us.pdf
Which system performs better using OFDM to service two different us.pdf
 
Which of the following statements is not truea.Every wallpaper pa.pdf
Which of the following statements is not truea.Every wallpaper pa.pdfWhich of the following statements is not truea.Every wallpaper pa.pdf
Which of the following statements is not truea.Every wallpaper pa.pdf
 
Which of the following demonstrates ectothermic behaviorQuestion .pdf
Which of the following demonstrates ectothermic behaviorQuestion .pdfWhich of the following demonstrates ectothermic behaviorQuestion .pdf
Which of the following demonstrates ectothermic behaviorQuestion .pdf
 
What role does childrens play have in motor delopment What r.pdf
What role does childrens play have in motor delopment What r.pdfWhat role does childrens play have in motor delopment What r.pdf
What role does childrens play have in motor delopment What r.pdf
 
What questions are descriptive studies designed to answerSoluti.pdf
What questions are descriptive studies designed to answerSoluti.pdfWhat questions are descriptive studies designed to answerSoluti.pdf
What questions are descriptive studies designed to answerSoluti.pdf
 
What is a current liability Distinguish between a current liability.pdf
What is a current liability Distinguish between a current liability.pdfWhat is a current liability Distinguish between a current liability.pdf
What is a current liability Distinguish between a current liability.pdf
 
What are some of the evolutionary evidence that suggests we evolv.pdf
What are some of the evolutionary evidence that suggests we evolv.pdfWhat are some of the evolutionary evidence that suggests we evolv.pdf
What are some of the evolutionary evidence that suggests we evolv.pdf
 
What are the five signs of tissue injurySolutionAnsThe fiv.pdf
What are the five signs of tissue injurySolutionAnsThe fiv.pdfWhat are the five signs of tissue injurySolutionAnsThe fiv.pdf
What are the five signs of tissue injurySolutionAnsThe fiv.pdf
 
We regularly allow beer companies to advertise across various mass m.pdf
We regularly allow beer companies to advertise across various mass m.pdfWe regularly allow beer companies to advertise across various mass m.pdf
We regularly allow beer companies to advertise across various mass m.pdf
 
A father and his son were watching Jeopardy on TV. The son, a compute.pdf
A father and his son were watching Jeopardy on TV. The son, a compute.pdfA father and his son were watching Jeopardy on TV. The son, a compute.pdf
A father and his son were watching Jeopardy on TV. The son, a compute.pdf
 
The purchase of inventory would be considered aA.cash outflow fr.pdf
The purchase of inventory would be considered aA.cash outflow fr.pdfThe purchase of inventory would be considered aA.cash outflow fr.pdf
The purchase of inventory would be considered aA.cash outflow fr.pdf
 
The mission of University is the transformation of the whole person .pdf
The mission of University is the transformation of the whole person .pdfThe mission of University is the transformation of the whole person .pdf
The mission of University is the transformation of the whole person .pdf
 
The firm is Tesla Motors1.Based on information in the annual repor.pdf
The firm is Tesla Motors1.Based on information in the annual repor.pdfThe firm is Tesla Motors1.Based on information in the annual repor.pdf
The firm is Tesla Motors1.Based on information in the annual repor.pdf
 
4 A piece of lead metal was added to an aqueous solution of copper(I.pdf
4 A piece of lead metal was added to an aqueous solution of copper(I.pdf4 A piece of lead metal was added to an aqueous solution of copper(I.pdf
4 A piece of lead metal was added to an aqueous solution of copper(I.pdf
 
Researchers are interested in studying whether personality is relate.pdf
Researchers are interested in studying whether personality is relate.pdfResearchers are interested in studying whether personality is relate.pdf
Researchers are interested in studying whether personality is relate.pdf
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

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

  • 1. 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 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. Solution # i provided this solution earlier it had indentaion problem, not this solution is working perfectly fine. #=======code================= #you might get intendation error in your system. 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=int(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()
  • 2. moresongs=int(input("press 1 to stop adding songs")) if moresongs==1: entering=False f = open("songsfile.txt","r") contents = f.read() f.close() print (contents)