IB Computer Science Year 1 Standard Level - May 18 2018 Lesson Notes: Difference between revisions
Mr. MacKenty (talk | contribs) |
Mr. MacKenty (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 9: | Line 9: | ||
1. Copy this code into whatever you are running python in: | 1. Copy this code into whatever you are running python in: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="Python"> | ||
credentials = {'joe':'mypassword', 'anna':'annpassword', 'pawel':'password123!'} | credentials = {'joe':'mypassword', 'anna':'annpassword', 'pawel':'password123!'} | ||
Line 33: | Line 33: | ||
4. Please design and implement: | 4. Please design and implement: | ||
<br /> | |||
4.1 A function to get consent to process data. This consent must be stored. | 4.1 A function to get consent to process data. This consent must be stored. | ||
<br /> | |||
4.2 A function to remove consent. | 4.2 A function to remove consent. | ||
<br /> | |||
4.3 A function that realizes "the right to be forgotten" | 4.3 A function that realizes "the right to be forgotten" | ||
It may be helpful to have this code later: | |||
<syntaxhighlight lang="Python"> | |||
credentials = {'joe':'mypassword', 'anna':'annpassword', 'pawel':'password123!'} | |||
global logged_in | |||
def main(): | |||
while True: | |||
print("="*45) | |||
print("Welcome to our application thing!") | |||
print("="*45) | |||
print("1. Login") | |||
print("Menu option 2") | |||
print("Menu option 3") | |||
print("Menu option 4") | |||
print("Menu option 5") | |||
print("Menu option 6") | |||
print("Menu option 7") | |||
print("\n") | |||
print("enter 99 to quit") | |||
print("\n") | |||
choice = input("Enter your choice > ") | |||
if choice == "99": | |||
break | |||
elif choice == "1": | |||
login() | |||
elif choice == "2": | |||
print("You have selected choice 2.") | |||
elif choice == "3": | |||
print("You have selected choice 3.") | |||
elif choice == "4": | |||
print("You have selected choice 4.") | |||
elif choice == "5": | |||
print("You have selected choice 5.") | |||
elif choice == "6": | |||
print("You have selected choice 6.") | |||
elif choice == "7": | |||
print("You have selected choice 7.") | |||
return | |||
def login(): | |||
name = input("Please enter your name: ") | |||
if name in credentials: | |||
password = input("Please enter your password: ") | |||
if credentials[name] == password: | |||
print("Correct password") | |||
print("We can now continue on with our program") | |||
logged_in = True | |||
return logged_in | |||
else: | |||
print("incorrect password") | |||
else: | |||
print("We don't have that user in our system.") | |||
main() | |||
</syntaxhighlight> | |||
</td> | </td> |
Latest revision as of 13:46, 2 July 2019
What are we going to learn today?[edit]Today's class we will review our test and we will be working through a real-world coding exercise. 1. Copy this code into whatever you are running python in: credentials = {'joe':'mypassword', 'anna':'annpassword', 'pawel':'password123!'}
# this would be a good place to consider consent.
name = input("Please enter your name: ")
if name in credentials:
password = input("Please enter your password: ")
if credentials[name] == password:
print("Correct password")
print("We can now continue on with our program")
else:
print("incorrect password")
else:
print("We don't have that user in our system.")
3. Please review this page on the GDPR 4. Please design and implement:
credentials = {'joe':'mypassword', 'anna':'annpassword', 'pawel':'password123!'}
global logged_in
def main():
while True:
print("="*45)
print("Welcome to our application thing!")
print("="*45)
print("1. Login")
print("Menu option 2")
print("Menu option 3")
print("Menu option 4")
print("Menu option 5")
print("Menu option 6")
print("Menu option 7")
print("\n")
print("enter 99 to quit")
print("\n")
choice = input("Enter your choice > ")
if choice == "99":
break
elif choice == "1":
login()
elif choice == "2":
print("You have selected choice 2.")
elif choice == "3":
print("You have selected choice 3.")
elif choice == "4":
print("You have selected choice 4.")
elif choice == "5":
print("You have selected choice 5.")
elif choice == "6":
print("You have selected choice 6.")
elif choice == "7":
print("You have selected choice 7.")
return
def login():
name = input("Please enter your name: ")
if name in credentials:
password = input("Please enter your password: ")
if credentials[name] == password:
print("Correct password")
print("We can now continue on with our program")
logged_in = True
return logged_in
else:
print("incorrect password")
else:
print("We don't have that user in our system.")
main()
|
What is our home learning?[edit] |
How am I being assessed today?[edit]I will assess you formatively today, and make a professional judgement to what extent you understand our learning material. I will use observation, your written work, answers to questions, and contribution to class discussions as data to make my decisions. I normally record my observations in a "evidence of learning" spreadsheet, which I will happily share with you privately if you so wish. I usually need a day or two notice. I will also ask you to complete a self-assessment which I will use to help me guage how well you think you understand our material in class. |
|
As a computer scientist, you have:[edit]
|
|
Credits[edit] |