Question

Python Create a function called creditsPerQuarter. It will receive parameters: student, numCreds, numCourses. You will pass...

Python

  1. Create a function called creditsPerQuarter. It will receive parameters: student, numCreds, numCourses. You will pass in a students name, the number of credits each course they are taking is and the number of courses they are taking. Within the function, you will calculate the total number of credits that student has that quarter. You will RETURN the following string: (student name) is taking (number of courses) courses and each course is (number of credits each course is) for a total of (calculated total credits). For example: If the student is Bob and he is taking 4 courses with 3 credit each it would read exactly:
    "Bob is taking 4 courses and each course is 3 credits for a total of 12."

You will call creditsPerQuarter three times and pass in these arguments:

  • Student Name: Wade, Credit per Course: 3, Number of courses: 4
  • Student Name: Jane, Credit per Course: 3, Number of courses: 5
  • Student Name: Evan, Credit per Course: 5, Number of courses: 3

Your output should look like this exactly:

Wade is taking 4 courses and each course is 3 credits for a total of 12.
Jane is taking 5 courses and each course is 3 credits for a total of 15.
Evan is taking 3 courses and each course is 5 credits for a total of 15.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#definition of function creditsPerQuater
def creditsPerQuater(student,numCreds,numCourses):
#calculating totalCredits
totalCredits = numCourses * numCreds;
#store the entire message into the str1 variable
#Here str is used to convert type int to type string
str1 = str(student)+" is taking "+str(numCourses)+" courses and each course is "+str(numCreds)+" credits for a total of "+str(totalCredits)
#return str1 to called function
return str1

i=0
#Repeat the loop 3 times
while i<3:
#Reads Student name
student = input("Enter the name: ")
#Reads number of credits.
#input - returns the input as string.So we have to convert to int
numCreds = int(input("Enter number of credits in each course: "))
#Reads number of courses
numCourses = int(input("Enter number of courses: "))
#Prints the message
print("Student Name:",student,",Credit per Course:",numCreds,",Number of courses:",numCourses);
#Calling the function creditsPerQuater and store the return value in str1 variable
str1 = creditsPerQuater(student,numCreds,numCourses)
i= i+1
#Prints the string in str1
print(str1)

Add a comment
Know the answer?
Add Answer to:
Python Create a function called creditsPerQuarter. It will receive parameters: student, numCreds, numCourses. You will pass...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • NOTE: by using Android Studio .Please if you can provide SCREENSHOTSresults and process is the most...

    NOTE: by using Android Studio .Please if you can provide SCREENSHOTSresults and process is the most important parts. NO ONLY NEED CODE BECAUSE I HAVE IT AND DID IT BUT NEED JUST YOUR RESULTS PHOTOS AND PROCESS THATS COULD HELP ME IN MY PROCESS. Project 2: Course Management App Project description: This android app helps student manage their courses. It enables a student to check the course details(lecturer, term, credits), browse his or her courses, add or remove a course....

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • Write a Student class that stores information for a Montclair student. The class should include the...

    Write a Student class that stores information for a Montclair student. The class should include the following instance variables id, an integer identifier for the student lastName, a string for the student's last name creditsEarned, an integer representing the number of course-credits the student has earned courseLoadCredits, an integer representing the current number of credits in progress. status, an integer representing the status of the student (1 means freshman, 2 means sophomore, 3 means junior, 4 means senior). This status...

  • Part I (20%) [File: Student.java] Create a class called Student that has the following stored properties:...

    Part I (20%) [File: Student.java] Create a class called Student that has the following stored properties: • StudentID • First Name • Last Name Class Student should have read/write properties, constructor(s) and should implement the Academic interface. For academic methods, return zero for average, zero for credits and false for graduate. Also implement the toString() method that returns the above information as a String. Part II (5%) [File: Academic.java] Create an interface Academic that declares three methods: 1. average -...

  • For this assignment we are going to create the beginnings of a simple Grade Book. We...

    For this assignment we are going to create the beginnings of a simple Grade Book. We will revisit this assignment again once we learn some new concepts. For the purposes of this grade book you should first provide a menu with the following options: 1. Add a new course 2. Add a new student 3. Add a student to a course 4. Add grades for a student in a course 5. Print a list of all grades for a student...

  • (7) Student grade point statistics [Problem description] There is a need to make statistics of the grade points o...

    (7) Student grade point statistics [Problem description] There is a need to make statistics of the grade points of the students in the first semester of 2018. It is assumed that there are n (can be set as 6) classes in this grade, and there are 20 students in each class, the total number of courses with exam is m (can be set as 10), and the percentage system is adopted for each course. The gpa is 4, 3, 2,1,...

  • Student(Student number, student name, semester) Course(Course number, course name, credits, transfer credits) PART A: Using above...

    Student(Student number, student name, semester) Course(Course number, course name, credits, transfer credits) PART A: Using above BS in MIS degree requirements, perform the following (25 points) Develop tables (provide create statements) Normalize them (make sure they are in 3rd NF) Draw a single ERD – clearly identify Primary and Foreign keys (state any assumptions made) (10 points) Create following views: (5 points) Create a view that would list all MIS required courses Create a view that will give a total...

  • Program 5 Due 10/25 C-String and Two-dimensional Array Use An input data file starts with a...

    Program 5 Due 10/25 C-String and Two-dimensional Array Use An input data file starts with a student's name (on one line). Then, for each course the student took last semester, the file has 2 data lines. The course name is on the first line. The second line has the student's grade average (0 to 100) and the number of credits for the course Sample data: Jon P. Washington, Jr. Computer Science I 81 4 PreCalculus 75 3 Biology I 88...

  • Write a program that determines how many terms 10 students need to graduate. Step 1. Create...

    Write a program that determines how many terms 10 students need to graduate. Step 1. Create an algorithm (either flowchart or pseudocode) that you will use to write the program. Place the algorithm in a Word document. Step 2. Code the program in Eclipse and ensure the following steps are accomplished. 1.  Define a two-dimension array with 10 rows and 2 columns. 2.  Prompt the user to enter the number of courses they have left to graduate (value must be between 1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT