CSCI 1301 Study Guide - Quiz Guide: Emergency Notification System

28 views4 pages
School
Course
Professor
CODING PROBLEMS:
PROBLEM 1: Average Temperature
Function Name: averageTemp()
Parameters:
List - a list of integers
Return Value: None
Description:
Fall is (very) slowly arriving, so it’s almost time to pull out those cozy sweaters.
Write a function that takes in a list of integers, prints out the average temperature, then
prints another statement based on the average. If the average is less than 50, print “It's
starting to get chilly.” If the average is above 80, print “It's still pretty hot.” Otherwise,
print “"It feels nice outside!".
Test Cases:
>>>averageTemp([43,36,51,48,45,47,44,58,47,50])
The average temperature is 46.
It's starting to get chilly.
>>>averageTemp([95,63,98,57,93,86,79,82])
The average temperature is 81.
It's still pretty hot.
>>>averageTemp([54,51,53,53,44,48,52])
The average temperature is 50.
It feels nice outside!
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Document Summary

Fall is (very) slowly arriving, so it"s almost time to pull out those cozy sweaters. Write a function that takes in a list of integers, prints out the average temperature, then prints another statement based on the average. If the average is less than 50, print it"s starting to get chilly. if the average is above 80, print it"s still pretty hot. otherwise, print "it feels nice outside! The government has put you in charge of encoding secret messages (don"t ask too many questions pal). Write a function that takes in a phrase and changes the following: the letter a to @ , the letter e to 3 , the letter i to 1 , the letter o to 0 (zero), and the letter s to \$ . Be sure to accommodate capital and lowercase letters! >>>encoder("this is a test of the georgia tech emergency notification system") Th1\$ 1\$ @ t3 0f th3 g30rg1@ t3ch 3m3rg3ncy n0t1f1c@t10n .