Questions
USING PYTHON 3.7: import Student as st import random THRESHOLD = 0.01 tests = 0 passed...

USING PYTHON 3.7:

import Student as st
import random

THRESHOLD = 0.01
tests = 0
passed = 0

def main():
   test_get_higher_grade_student()
   test_is_grade_above()
   test_get_students()
   test_get_classlist()
   # test_count_above()
   # test_get_average_grade()
   print("TEST RESULTS:", passed, "/", tests)

def test_get_higher_grade_student():
   s1a = st.Student("V0002000", 89)
   s1b = st.Student("V0002001", 89)
   s2 = st.Student("V0002002", 67)
   s3 = st.Student("V0002002", 97)

   result = get_higher_grade_student(s1a,s1b)
   print_test("get_higher_grade_student(s1a,s1b)", result == s1a)

   result = get_higher_grade_student(s1a,s2)
   print_test("get_higher_grade_student(s1a,s1b)", result == s1a)

   result = get_higher_grade_student(s1a,s3)
   print_test("get_higher_grade_student(s1a,s1b)", result == s3)


# (Student, Student -> bool)
# returns the Student with higher grade of s1 and s2, or s1 if grades are equal
def get_higher_grade_student(s1, s2):

   print("fix me")
   # TODO: complete get_higher_grade_student
   # this should not always return s1
   return s1

def test_is_grade_above():
   s1 = st.Student("V0002000", 89)
   s2 = st.Student("V0002002", 67)

   result = is_grade_above(s1, 89)
   print_test("is_grade_above(s1, 89)", result == False)

   result = is_grade_above(s1, 88)
   print_test("is_grade_above(s1, 89)", result == True)

   result = is_grade_above(s2, 50)
   print_test("is_grade_above(s2, 50)", result == True)

   result = is_grade_above(s2, 80)
   print_test("is_grade_above(s2, 80)", result == False)


# (Student, int -> bool)
# returns True if the grade of Student s is above the given integer
def is_grade_above(s, n):

   print("fix me")
   # TODO: complete is_grade_above

def test_get_students():
   result = get_students('studentData.txt')
   expected = [st.Student('V00123456', 89),st.Student('V00123457', 99),
   st.Student('V00123458', 30),st.Student('V00123459', 78)]
   print_test("result = get_students('studentData.txt')", result == expected)


# (str -> (list of Student))
# creates a new list of Students from data in the file named filename
# where each line of file has a sid and grade separated by a comma
def get_students(filename):

   print("fix me")
   # TODO: complete get_students

def test_get_classlist():
   students = []
   result = get_class_list(students)
   expected = []
   print_test("result = get_classlist(students)", result == expected)

   students = [st.Student('V00123456', 89),st.Student('V00123457', 99),
   st.Student('V00123458', 30),st.Student('V00123459', 78)]
   result = get_class_list(students)
   expected = ['V00123456','V00123457','V00123458','V00123459']
   print_test("result = get_classlist(students)", result == expected)


# ((list of Student) -> (list of str))
# returns a new list of Students ids for each Student in students
def get_class_list(students):

   print("fix me")
   # TODO: complete get_classlist


# TODO:
# Design and test a function that will take a list of Students
# and a grade and counts and return the number of Students
# who have a grade above the given grade

# TODO:
# Design and test a function that will take a list of Students
# computes and returns the average grade of all Students in students

# (str, bool -> None)
# prints test_name and "passed" if expr is True otherwise prints "failed"
def print_test(test_name, expr):
   global tests
   global passed
   tests += 1
   if(expr):
       print(test_name + ': passed')
       passed += 1
   else:
       print(test_name + ': failed')


# The following code will call your main function
# It also allows our grading script to call your main
# DO NOT ADD OR CHANGE ANYTHING PAST THIS LINE
# DOING SO WILL RESULT IN A ZERO GRADE
if __name__ == '__main__':
   main()

studentData.txt ->

V00123456, 89
V00123457, 19
V00123458, 30
V00123459, 78

-------------------------//---------------------------//-----------------------------//-----------------------

class Student:
# constructor
def __init__(self, sid, grade):
self.sid = sid
self.grade = grade

def __str__(self):
return self.sid + ':' + str(self.grade)

def __repr__(self):
return str(self)

def get_sid(self):
return self.sid

def get_grade(self):
return self.grade

def set_sid(self, sid):
self.sid = sid

def set_grade(self, grade):
self.grade = grade

def __eq__(self, other):
if self.sid == other.get_sid():
return True
else:
return False

def main():

print('exercise1')
s1 = Student('V00123456', 90)
print(s1)


s2 = Student('V00456789', 60)
list = [s1,s2]
print(list)

result = s1.get_sid()
print(result)
result = s1.get_grade()
print(result)

s1.set_grade(98)
s1.set_sid("V00222210")
print(s1)


s1 = Student("V0002000", 89)
print(s1)

s2 = Student("V0002000", 67)

print(s2)

s3 = Student("V0002001", 67)
print(s3)

print(s1 == s2)
print(s1 == s1)
print(s1.__eq__(s2))
print(s2.__eq__(s3))

s1a = Student("V0002000", 89)
s1b = Student("V0002020", 65)
#
s2a = Student("V0002000", 67)
s2b = Student("V0002020", 65)
#
list1 = [s1a,s1b]
list2 = [s2a,s2b]
list3 = [s1a,s2a]
#
print('list1==list1', list1==list1)
print('list1==list2', list1==list2)
print('list1==list3', list1==list3)

main()

In: Computer Science

How is the coronavirus pandemic affecting the labour market and education plans for Canadian University students?...

How is the coronavirus pandemic affecting the labour market and education plans for Canadian University students? (Students may have lost their ability to support themselves through work or with help from family, there may be foreign students who face travel restrictions, etc., some may be graduating into a market with poor employment prospects while carrying large student loans, etc. List all the possible problem scenarios that you can think of.)

In: Economics

What is convection cooling? How can you construct a building so that convection cooling occurs? What...

What is convection cooling? How can you construct a building so that convection cooling occurs?

What are thermal bridges? Give an example of some ways to eliminate them when you are building?

What is the intention of the Innovation and Design Credits? What are the responsibilities of the LEED Accredited Professional on a project?

In: Civil Engineering

Bridges Not Walls uses a metaphor of breathing (inhaling/exhaling) to explore the process of interpersonal communication....

Bridges Not Walls uses a metaphor of breathing (inhaling/exhaling) to explore the process of interpersonal communication. Use stereotyping to define the concept and discuss why it is important for interpersonal communication to be effective, what skills are necessary, and implications when these skills are lacking. Support assertions with references to Stewart and his co-authors.

In: Psychology

I would like to power and drive a vehicle using: 2 x 6V geared mini DC...

I would like to power and drive a vehicle using:

2 x 6V geared mini DC motors
1 x 5V Color recognition sensor
1 x Arduino Nano

I this possible? If so please explain how and provide a detailed schematic and list of parts needed. How do I supply 6 V to each motor, if the Arduino Nano only puts out 5 V?

Thanks

In: Electrical Engineering

Q27. Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 95 , 57 Suppose we...

Q27. Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 95 , 57

Suppose we have assigned grades for the 11 students in our data:Grade A for students who scored ≥ 90; B for students who scored ≥ 80 and < 90; C for students who scored ≥ 70 and < 80; D for students who scored ≥ 60 and < 70; F for students who scored < 60.

Following the above grade scheme, we observe that we have 7 students who received grade A, 1 student received grade B, 0 students received grade C, 0 students received grade D and 1 student received grade F. Using this, please answer the following questions:

(i). Considering grade C or above as a pass grade, how many students from this data successfully passed the course?

(ii). Considering grade C or above as a pass grade, what is the probability for a student to receive a pass grade?

(iii). What is the probability for a student not receiving a pass grade?

(iv). What is the probability that the student received grade A or grade B?

(v). What is the probability that the student received grade A, grade B, or grade C?

(vi). Do you consider the events in the previous question as mutually exclusive events?

Yes

No

Maybe

(vii). What is the probability that a student received grade A and grade B?

In: Statistics and Probability

Q27. Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 95 , 57 Suppose we...

Q27. Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 95 , 57

Suppose we have assigned grades for the 11 students in our data:Grade A for students who scored ≥ 90; B for students who scored ≥ 80 and < 90; C for students who scored ≥ 70 and < 80; D for students who scored ≥ 60 and < 70; F for students who scored < 60.

Following the above grade scheme, we observe that we have 7 students who received grade A, 1 student received grade B, 0 students received grade C, 0 students received grade D and 1 student received grade F. Using this, please answer the following questions:

(i). Considering grade C or above as a pass grade, how many students from this data successfully passed the course?

(ii). Considering grade C or above as a pass grade, what is the probability for a student to receive a pass grade?

(iii). What is the probability for a student not receiving a pass grade?

(iv). What is the probability that the student received grade A or grade B?

(v). What is the probability that the student received grade A, grade B, or grade C?

(vi). Do you consider the events in the previous question as mutually exclusive events?

Yes

No

Maybe

(vii). What is the probability that a student received grade A and grade B?

In: Statistics and Probability

Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 88,70 Suppose we have assigned grades...

Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 88,70 Suppose we have assigned grades for the 11 students in our data:Grade A for students who scored ≥ 90; B for students who scored ≥ 80 and < 90; C for students who scored ≥ 70 and < 80; D for students who scored ≥ 60 and < 70; F for students who scored < 60. Following the above grade scheme, we observe that we have 7 students who received grade A, 1 student received grade B, 0 students received grade C, 0 students received grade D and 1 student received grade F. Using this, please answer the following questions: (i). Considering grade C or above as a pass grade, how many students from this data successfully passed the course? (ii). Considering grade C or above as a pass grade, what is the probability for a student to receive a pass grade? (iii). What is the probability for a student not receiving a pass grade? (iv). What is the probability that the student received grade A or grade B? (v). What is the probability that the student received grade A, grade B, or grade C? (vi). Do you consider the events in the previous question as mutually exclusive events? Yes No Maybe (vii). What is the probability that a student received grade A and grade B?

In: Economics

Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 88,70 Suppose we have assigned grades...

Data 105, 91, 52, 86, 100, 96, 98, 109, 96, 88,70

Suppose we have assigned grades for the 11 students in our data:Grade A for students who scored ≥ 90; B for students who scored ≥ 80 and < 90; C for students who scored ≥ 70 and < 80; D for students who scored ≥ 60 and < 70; F for students who scored < 60.

Following the above grade scheme, we observe that we have 7 students who received grade A, 1 student received grade B, 0 students received grade C, 0 students received grade D and 1 student received grade F.

Using this, please answer the following questions:

(i). Considering grade C or above as a pass grade, how many students from this data successfully passed the course?

(ii). Considering grade C or above as a pass grade, what is the probability for a student to receive a pass grade?

(iii). What is the probability for a student not receiving a pass grade?

(iv). What is the probability that the student received grade A or grade B?

(v). What is the probability that the student received grade A, grade B, or grade C?

(vi). Do you consider the events in the previous question as mutually exclusive events? Yes No Maybe

(vii). What is the probability that a student received grade A and grade B?

In: Economics

In the context of “global mindset”, please list five suggestions on how School of Business and...

In the context of “global mindset”, please list five suggestions on how School of Business and Government can boost its students’ global psychological capital.

In: Accounting