Ask your own question, for FREE!
Mathematics 10 Online
OpenStudy (anonymous):

what's wrong with this python code ! please help ! def arr[] = make_list('file_name'): fin = open('file_name') t = [ ] for line in fin: text = line.rstrip('\r\n') number = int(text) t.append(number) it actually shows error in first line "def arr[] = make_list('file_name'):" so please explain .thanks

OpenStudy (anonymous):

which programm u r using

OpenStudy (anonymous):

python

OpenStudy (turingtest):

1)Welcome to Open Study 2) this is a computer science question, please post in that section. you are cuurently in the math group 3) I don't think python likes you using an assignment in the same line as the definition. also, I'm not understanding why you have the variable file_name as a string in the definition; file_name is a variable as far as this program is concerned, and can be assigned to a string or whatever later when you run it. I'm not an expert in python though. perhaps something like def make_list(file_name): fin=open(file_name) t=[] for line in fin: text = line.rstrip('\r\n') number = int(text) t.append(number)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!