Scientific Computing
The exam approaches. What else would you like to have practice with? What thing in python do you struggle with the most? Pick one or more options below. We can do any of these together in class. You can also pick ANY of the previous in-class activities.
multiPrint
which accepts two parameters: a string and a nonnegative integer representing the number of times that the string should be printeddisplayStudentInfo
which accepts two parameters: a string representing a student’s name and a nonnegative integer representing the student’s age. The function should print a sentence about the student. For example, displayStudentInfo("Bob", 20)
would print “Bob is a 20 year old student.”toCelsius(temperature)
that converts Fahrenheit degrees to Celsius degrees. (Hint: C = (F-32)*(5/9)).isEven
that takes one parameter (a nonnegative integer). The function will return the boolean value True
if the given number is even, otherwise, it will return the boolean value False
getGrade
which accepts one parameter: a nonnegative integer score between 0 and 100. The function should return the string “A”, “B”, “C”, “D”, or “F” using the standard grading scale.positivity
which accepts one parameter: an integer n. The function should print either “positive number”, “zero”, or “negative number” depending on the value of n.n
sides.snowFall
and prints out:
snowFall
is over 10snowFall
is greater than 7 but less than 10snowFall
is greater than 3 but less than or equal to 7, andsnowFall
is less than 3isItRaining
which returns False with 90% probability.magicEightBallSays
which randomly prints one of the following:
grade
which randomly has the value A,B,C,D, or F.coinSide
which randomly has the value 0 or 1.Cool beans. Pick one question from each section (one from A, one from B, from C, from D, and from E) and complete it independently.
Save your work and submit it to Moodle.