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













-2















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









share|improve this question



















  • 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















-2















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









share|improve this question



















  • 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













-2












-2








-2








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









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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











  • 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












  • 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







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












1 Answer
1






active

oldest

votes


















0














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





share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









0














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





share|improve this answer























  • 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















0














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





share|improve this answer























  • 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













0












0








0







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





share|improve this answer













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






share|improve this answer












share|improve this answer



share|improve this answer










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 it self.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











  • @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
















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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme