IB Computer Science Year 1 Higher Level - May 18 2018 Lesson Notes

From Computer Science Wiki
Jump to navigation Jump to search

Class plan.png 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.")


2. Please understand how this code works. I'll go over it with you.

3. Please review this page on the GDPR

4. Please design and implement:
4.1 A function to get consent to process data. This consent must be stored.
4.2 A function to remove consent.
4.3 A function that realizes "the right to be forgotten"


It may be helpful to have this code later:

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()

Homework.png What is our home learning?[edit]

Target.png 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.

Computer1.png As a computer scientist, you have:[edit]

  • Confidence in dealing with complexity
  • Persistence in working with difficult problems
  • Tolerance for ambiguity
  • The ability to deal with open-ended problems
  • The ability to communicate and work with others to achieve a common goal or solution

Credit.png Credits[edit]

Produce a plan, simulation or model.

Consider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument.