Python Review - Cart1233/PHYS250 GitHub Wiki
We did the following in class
- Imported modules
- Defining variables
- lists
- print statements
- formatting print statements
- writing and calling functions as well proving them true and returning them
- For loops
- while loops
- Conditionals
- Some basic plottings
def lucky7(test_value):
""" Check if the input number is equal to 7 and between 1 and 10"""
if test_value > 10:
print("Reject input, value is too high")
return 99
elif test_value < 1:
print("Reject input, value is too low")
return -99
elif test_value == 7:
print("Lucky guess")
return 1
else:
print("Not correct")
return 0