Created
June 2, 2017 03:02
-
-
Save benjamincohen1/0ae13a9b8ca2bd8bac22377e4220950d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Thu Jun 1 20:49:45 2017 | |
@author: ben | |
""" | |
# take a list of numbers and find their average | |
numbers = [80, 90, 95, 78, 100, 0, 0, 0, 0, 0] | |
total = 0.0 | |
for number in numbers: | |
# print index | |
# next_number = numbers[index] | |
# print next_number | |
total = total + number | |
print "Running total: " + str(total) | |
# | |
myaverage = total / len(numbers) | |
print 'Your average is: ' + str(myaverage) | |
if myaverage == 100: | |
print "Wow, a perfect score!" | |
elif myaverage >= 90 and len(numbers) > 10: | |
print 'You got an A over a bunch of test' | |
elif myaverage >= 90: | |
print 'A' | |
elif myaverage >= 80: | |
print 'B' | |
elif myaverage >= 70: | |
print 'C' | |
elif myaverage >= 60: | |
print 'D' | |
else: | |
# print 'F' | |
#expected output is 25 | |
mydict = { | |
'house': 'a bulding people live in', | |
'dog': 'a friend with 4 legs', | |
'car': 'a thing to get around', | |
'second_dict': {'mykey': 'some value'} | |
} | |
mydict['dog'] = 'a 4 legged friend that barks' | |
print mydict['dog'] | |
print mydict.keys() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment