How to make a function that calls aand prints each students name and coursesCalling a function of a module by using its name (a string)How to flush output of print function?How to get a function name as a string in Python?How to print without newline or space?How can I make a time delay in Python?How to make a chain of function decorators?How to print number with commas as thousands separators?How to make a class JSON serializableHow can I print literal curly-brace characters in python string and also use .format on it?How find the max of a list and then store the max in a new list
Unable to supress ligatures in headings which are set in Caps
What is the idiomatic way to say "clothing fits"?
Reverse dictionary where values are lists
Determining Impedance With An Antenna Analyzer
Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?
How to show a landlord what we have in savings?
Solving a recurrence relation (poker chips)
Why didn't Miles's spider sense work before?
What about the virus in 12 Monkeys?
Size of subfigure fitting its content (tikzpicture)
How do I gain back my faith in my PhD degree?
Which is the best way to check return result?
How does a predictive coding aid in lossless compression?
Arrow those variables!
Could the museum Saturn V's be refitted for one more flight?
How would I stat a creature to be immune to everything but the Magic Missile spell? (just for fun)
Why doesn't using multiple commands with a || or && conditional work?
Extract rows of a table, that include less than x NULLs
Assassin's bullet with mercury
How writing a dominant 7 sus4 chord in RNA ( Vsus7 chord in the 1st inversion)
What do you call someone who asks many questions?
Alternative to sending password over mail?
Is it inappropriate for a student to attend their mentor's dissertation defense?
How do I handle a potential work/personal life conflict as the manager of one of my friends?
How to make a function that calls aand prints each students name and courses
Calling a function of a module by using its name (a string)How to flush output of print function?How to get a function name as a string in Python?How to print without newline or space?How can I make a time delay in Python?How to make a chain of function decorators?How to print number with commas as thousands separators?How to make a class JSON serializableHow can I print literal curly-brace characters in python string and also use .format on it?How find the max of a list and then store the max in a new list
Here is what i have so far
from CSE_324_course import Course
from CSE_324_skeleton_student import Student
math = Course("Algebra I")
language = Course("Spanish I")
science = Course("Earth Science")
history = Course("U.S. History I")
phys_ed = Course("Physical Education I")
speaking = Course("Speech I")
art = Course("Art I")
test_student = Student("Jill", "Sample")
test_student.add_course(math)
test_student.add_course(language)
test_student.add_course(science)
test_student.add_course(history)
test_student2 = Student("Bill", "Sample")
test_student2.add_course(math)
test_student2.add_course(phys_ed)
test_student2.add_course(science)
test_student2.add_course(history)
test_student3 = Student("Kim", "Sample")
test_student3.add_course(language)
test_student3.add_course(speaking)
test_student3.add_course(science)
test_student3.add_course(art)
student_list=[test_student,test_student2,test_student3]
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
#Each iteration should:
#get,concatenate, and print the first and last name of the student
#print all courses for that student
#print a blank line between students
'''for this part you may need to review the other skeleton code to:
- see how to get items from a list
- see if there is code (like a function) in that file you can call in this file
- verify that running this file gets you the correct output with information from that file
Also, review syntax of pulling items from a list f
2 page of code
Course import Course
class Student:
student_id = 0
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
self.courses = []
self.student_id = Student.student_id
Student.student_id += 1
def __str__(self):
# TODO You will need to use a variable in the loop, so you must intialize it here,
# that variable will need to be initalized to get items listed in the first def _init_ section
# TODO add a loop that will go through the course list
# TODO Add code here to create a string representation of a student,
# including first and last name and all courses that student is taking
return "complete this return statement based on your in loop variable"
def get_first_name(self):
return self.first_name
def get_last_name(self):
return self.last_name
def get_student_id(self):
return self.student_id
def add_course(self, new_course):
# TODO add code to append new_course to self.courses
print "Course not yet added, implementation needed."
3rd page
class Course:
def __init__(self, course_name):
self.course_name = course_name
def __str__(self):
return self.course_name
python
add a comment |
Here is what i have so far
from CSE_324_course import Course
from CSE_324_skeleton_student import Student
math = Course("Algebra I")
language = Course("Spanish I")
science = Course("Earth Science")
history = Course("U.S. History I")
phys_ed = Course("Physical Education I")
speaking = Course("Speech I")
art = Course("Art I")
test_student = Student("Jill", "Sample")
test_student.add_course(math)
test_student.add_course(language)
test_student.add_course(science)
test_student.add_course(history)
test_student2 = Student("Bill", "Sample")
test_student2.add_course(math)
test_student2.add_course(phys_ed)
test_student2.add_course(science)
test_student2.add_course(history)
test_student3 = Student("Kim", "Sample")
test_student3.add_course(language)
test_student3.add_course(speaking)
test_student3.add_course(science)
test_student3.add_course(art)
student_list=[test_student,test_student2,test_student3]
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
#Each iteration should:
#get,concatenate, and print the first and last name of the student
#print all courses for that student
#print a blank line between students
'''for this part you may need to review the other skeleton code to:
- see how to get items from a list
- see if there is code (like a function) in that file you can call in this file
- verify that running this file gets you the correct output with information from that file
Also, review syntax of pulling items from a list f
2 page of code
Course import Course
class Student:
student_id = 0
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
self.courses = []
self.student_id = Student.student_id
Student.student_id += 1
def __str__(self):
# TODO You will need to use a variable in the loop, so you must intialize it here,
# that variable will need to be initalized to get items listed in the first def _init_ section
# TODO add a loop that will go through the course list
# TODO Add code here to create a string representation of a student,
# including first and last name and all courses that student is taking
return "complete this return statement based on your in loop variable"
def get_first_name(self):
return self.first_name
def get_last_name(self):
return self.last_name
def get_student_id(self):
return self.student_id
def add_course(self, new_course):
# TODO add code to append new_course to self.courses
print "Course not yet added, implementation needed."
3rd page
class Course:
def __init__(self, course_name):
self.course_name = course_name
def __str__(self):
return self.course_name
python
1
System.out.println(teststudnetgetCourse());
? This looks like Java.
– juanpa.arrivillaga
Mar 7 at 21:48
1
Anyway, the code formatting is off. The easiest way to format is to copy and paste directly from your text-editor, then highlight the text you've pasted into StackOverflow and press ctrl-K
– juanpa.arrivillaga
Mar 7 at 21:49
Thefor (test_student,test_student2,test_student3 : get_course)
looks very Java-ish, too. Regardless,student_list
is a list, so asking how to "make a function student_list` doesn't really make sense. Please edit your question an clear-up these matters.
– martineau
Mar 7 at 23:02
I'm a beginner at python and what I'm really trying to do is call a function that prints each student name and courses their taking
– Kany A
Mar 8 at 22:13
add a comment |
Here is what i have so far
from CSE_324_course import Course
from CSE_324_skeleton_student import Student
math = Course("Algebra I")
language = Course("Spanish I")
science = Course("Earth Science")
history = Course("U.S. History I")
phys_ed = Course("Physical Education I")
speaking = Course("Speech I")
art = Course("Art I")
test_student = Student("Jill", "Sample")
test_student.add_course(math)
test_student.add_course(language)
test_student.add_course(science)
test_student.add_course(history)
test_student2 = Student("Bill", "Sample")
test_student2.add_course(math)
test_student2.add_course(phys_ed)
test_student2.add_course(science)
test_student2.add_course(history)
test_student3 = Student("Kim", "Sample")
test_student3.add_course(language)
test_student3.add_course(speaking)
test_student3.add_course(science)
test_student3.add_course(art)
student_list=[test_student,test_student2,test_student3]
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
#Each iteration should:
#get,concatenate, and print the first and last name of the student
#print all courses for that student
#print a blank line between students
'''for this part you may need to review the other skeleton code to:
- see how to get items from a list
- see if there is code (like a function) in that file you can call in this file
- verify that running this file gets you the correct output with information from that file
Also, review syntax of pulling items from a list f
2 page of code
Course import Course
class Student:
student_id = 0
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
self.courses = []
self.student_id = Student.student_id
Student.student_id += 1
def __str__(self):
# TODO You will need to use a variable in the loop, so you must intialize it here,
# that variable will need to be initalized to get items listed in the first def _init_ section
# TODO add a loop that will go through the course list
# TODO Add code here to create a string representation of a student,
# including first and last name and all courses that student is taking
return "complete this return statement based on your in loop variable"
def get_first_name(self):
return self.first_name
def get_last_name(self):
return self.last_name
def get_student_id(self):
return self.student_id
def add_course(self, new_course):
# TODO add code to append new_course to self.courses
print "Course not yet added, implementation needed."
3rd page
class Course:
def __init__(self, course_name):
self.course_name = course_name
def __str__(self):
return self.course_name
python
Here is what i have so far
from CSE_324_course import Course
from CSE_324_skeleton_student import Student
math = Course("Algebra I")
language = Course("Spanish I")
science = Course("Earth Science")
history = Course("U.S. History I")
phys_ed = Course("Physical Education I")
speaking = Course("Speech I")
art = Course("Art I")
test_student = Student("Jill", "Sample")
test_student.add_course(math)
test_student.add_course(language)
test_student.add_course(science)
test_student.add_course(history)
test_student2 = Student("Bill", "Sample")
test_student2.add_course(math)
test_student2.add_course(phys_ed)
test_student2.add_course(science)
test_student2.add_course(history)
test_student3 = Student("Kim", "Sample")
test_student3.add_course(language)
test_student3.add_course(speaking)
test_student3.add_course(science)
test_student3.add_course(art)
student_list=[test_student,test_student2,test_student3]
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
#Each iteration should:
#get,concatenate, and print the first and last name of the student
#print all courses for that student
#print a blank line between students
'''for this part you may need to review the other skeleton code to:
- see how to get items from a list
- see if there is code (like a function) in that file you can call in this file
- verify that running this file gets you the correct output with information from that file
Also, review syntax of pulling items from a list f
2 page of code
Course import Course
class Student:
student_id = 0
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
self.courses = []
self.student_id = Student.student_id
Student.student_id += 1
def __str__(self):
# TODO You will need to use a variable in the loop, so you must intialize it here,
# that variable will need to be initalized to get items listed in the first def _init_ section
# TODO add a loop that will go through the course list
# TODO Add code here to create a string representation of a student,
# including first and last name and all courses that student is taking
return "complete this return statement based on your in loop variable"
def get_first_name(self):
return self.first_name
def get_last_name(self):
return self.last_name
def get_student_id(self):
return self.student_id
def add_course(self, new_course):
# TODO add code to append new_course to self.courses
print "Course not yet added, implementation needed."
3rd page
class Course:
def __init__(self, course_name):
self.course_name = course_name
def __str__(self):
return self.course_name
python
python
edited Mar 8 at 22:14
Kany A
asked Mar 7 at 21:44
Kany AKany A
11
11
1
System.out.println(teststudnetgetCourse());
? This looks like Java.
– juanpa.arrivillaga
Mar 7 at 21:48
1
Anyway, the code formatting is off. The easiest way to format is to copy and paste directly from your text-editor, then highlight the text you've pasted into StackOverflow and press ctrl-K
– juanpa.arrivillaga
Mar 7 at 21:49
Thefor (test_student,test_student2,test_student3 : get_course)
looks very Java-ish, too. Regardless,student_list
is a list, so asking how to "make a function student_list` doesn't really make sense. Please edit your question an clear-up these matters.
– martineau
Mar 7 at 23:02
I'm a beginner at python and what I'm really trying to do is call a function that prints each student name and courses their taking
– Kany A
Mar 8 at 22:13
add a comment |
1
System.out.println(teststudnetgetCourse());
? This looks like Java.
– juanpa.arrivillaga
Mar 7 at 21:48
1
Anyway, the code formatting is off. The easiest way to format is to copy and paste directly from your text-editor, then highlight the text you've pasted into StackOverflow and press ctrl-K
– juanpa.arrivillaga
Mar 7 at 21:49
Thefor (test_student,test_student2,test_student3 : get_course)
looks very Java-ish, too. Regardless,student_list
is a list, so asking how to "make a function student_list` doesn't really make sense. Please edit your question an clear-up these matters.
– martineau
Mar 7 at 23:02
I'm a beginner at python and what I'm really trying to do is call a function that prints each student name and courses their taking
– Kany A
Mar 8 at 22:13
1
1
System.out.println(teststudnetgetCourse());
? This looks like Java.– juanpa.arrivillaga
Mar 7 at 21:48
System.out.println(teststudnetgetCourse());
? This looks like Java.– juanpa.arrivillaga
Mar 7 at 21:48
1
1
Anyway, the code formatting is off. The easiest way to format is to copy and paste directly from your text-editor, then highlight the text you've pasted into StackOverflow and press ctrl-K
– juanpa.arrivillaga
Mar 7 at 21:49
Anyway, the code formatting is off. The easiest way to format is to copy and paste directly from your text-editor, then highlight the text you've pasted into StackOverflow and press ctrl-K
– juanpa.arrivillaga
Mar 7 at 21:49
The
for (test_student,test_student2,test_student3 : get_course)
looks very Java-ish, too. Regardless, student_list
is a list, so asking how to "make a function student_list` doesn't really make sense. Please edit your question an clear-up these matters.– martineau
Mar 7 at 23:02
The
for (test_student,test_student2,test_student3 : get_course)
looks very Java-ish, too. Regardless, student_list
is a list, so asking how to "make a function student_list` doesn't really make sense. Please edit your question an clear-up these matters.– martineau
Mar 7 at 23:02
I'm a beginner at python and what I'm really trying to do is call a function that prints each student name and courses their taking
– Kany A
Mar 8 at 22:13
I'm a beginner at python and what I'm really trying to do is call a function that prints each student name and courses their taking
– Kany A
Mar 8 at 22:13
add a comment |
1 Answer
1
active
oldest
votes
I think you are looking to change
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
(which you have improperly indented) to:
for student in student_list:
print(" ".format(student.first_name, student.last_name))
for course in student.courses:
print(course) # This won't work because "2 page of code Course import Course" needs to be finished
print("n") # blank line between students
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
@KanyA Yeah, finish your other script where# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make itself.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053283%2fhow-to-make-a-function-that-calls-aand-prints-each-students-name-and-courses%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you are looking to change
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
(which you have improperly indented) to:
for student in student_list:
print(" ".format(student.first_name, student.last_name))
for course in student.courses:
print(course) # This won't work because "2 page of code Course import Course" needs to be finished
print("n") # blank line between students
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
@KanyA Yeah, finish your other script where# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make itself.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
add a comment |
I think you are looking to change
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
(which you have improperly indented) to:
for student in student_list:
print(" ".format(student.first_name, student.last_name))
for course in student.courses:
print(course) # This won't work because "2 page of code Course import Course" needs to be finished
print("n") # blank line between students
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
@KanyA Yeah, finish your other script where# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make itself.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
add a comment |
I think you are looking to change
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
(which you have improperly indented) to:
for student in student_list:
print(" ".format(student.first_name, student.last_name))
for course in student.courses:
print(course) # This won't work because "2 page of code Course import Course" needs to be finished
print("n") # blank line between students
I think you are looking to change
for (test_student,test_student2,test_student3 : get_course)
if (test_student().equals(search))
System.out.println(teststudnetgetCourse());
(which you have improperly indented) to:
for student in student_list:
print(" ".format(student.first_name, student.last_name))
for course in student.courses:
print(course) # This won't work because "2 page of code Course import Course" needs to be finished
print("n") # blank line between students
answered Mar 7 at 21:51
ReedinationerReedinationer
2,0921423
2,0921423
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
@KanyA Yeah, finish your other script where# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make itself.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
add a comment |
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
@KanyA Yeah, finish your other script where# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make itself.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
thanks do you have ay suggestion to how could change it so that it works.
– Kany A
Mar 14 at 0:07
@KanyA Yeah, finish your other script where
# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make it self.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
@KanyA Yeah, finish your other script where
# TODO add code to append new_course to self.courses
;print "Course not yet added, implementation needed."
You could make it self.courses.append(str(new_course))
– Reedinationer
Mar 14 at 17:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053283%2fhow-to-make-a-function-that-calls-aand-prints-each-students-name-and-courses%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
System.out.println(teststudnetgetCourse());
? This looks like Java.– juanpa.arrivillaga
Mar 7 at 21:48
1
Anyway, the code formatting is off. The easiest way to format is to copy and paste directly from your text-editor, then highlight the text you've pasted into StackOverflow and press ctrl-K
– juanpa.arrivillaga
Mar 7 at 21:49
The
for (test_student,test_student2,test_student3 : get_course)
looks very Java-ish, too. Regardless,student_list
is a list, so asking how to "make a function student_list` doesn't really make sense. Please edit your question an clear-up these matters.– martineau
Mar 7 at 23:02
I'm a beginner at python and what I'm really trying to do is call a function that prints each student name and courses their taking
– Kany A
Mar 8 at 22:13