diff --git a/overviews/week9.md b/overviews/week9.md new file mode 100644 index 0000000000000000000000000000000000000000..426e5b7d15833c0767e0c773404b8c10e8d79656 --- /dev/null +++ b/overviews/week9.md @@ -0,0 +1,41 @@ +# Week 9 + +**This weeks quiz:** https://go.uwe.ac.uk/ctapQuiz + +This week we will be introducing the formal and informal logic and beginning to start thinking about and working on the scenarios for the assessment. + +This weeks **second lecture** will be introduce the scenarios fully and you will select and begin working on this scenario. We will start working on the writing in the second hour of our practicals from this week! +## This week you are working on... + +### 👉 [THIS WEEKS TASK]() 👈 + +- Applying boolean logic to simulated real world problems through simple python programs +- Identifying informal logical fallacies in examples derived from the assessment scenarios + +## Have already completed ... + +You should have completed the setup by now. If MUST IMMEDIATELY address this! +Follow the [setup guide and ensuring you have done everything on the checklist](https://gitlab.uwe.ac.uk/ctap/ctap-resources/-/blob/main/guides/setup.md?ref_type=heads). You should then work to catch up on any missed sessions. +**Please make yourself known to your tutor if you are behind or we will not know to help you!** + +## By the end of the week... + +... you should have completed: + +- Tasks 1, 2 and 3 provided in `ctap-resources/practicals/week9/tasks.md` + +## Resources +- [practicals/week9/tasks.md](https://gitlab.uwe.ac.uk/ctap/ctap-resources/-/blob/main/practicals/week8/tasks.md) +- [Slides](https://go.uwe.ac.uk/ctapSlides) +- [Setup Guide](https://gitlab.uwe.ac.uk/ctap/ctap-resources/-/blob/main/guides/setup.md?ref_type=heads) +- [Markdown Guide](https://gitlab.uwe.ac.uk/ctap/ctap-resources/-/blob/main/guides/markdown.md?ref_type=heads) + +### External resources +- [Boolean Algebra in Python](https://pyeda.readthedocs.io/en/latest/boolalg.html) +- [Learn Python .org's interactive python tutorials](https://www.learnpython.org/) +- W3 schools [tutorial and reference](https://www.w3schools.com/python/) + +## Videos + +- [Introduction to Boolean Algebra | Python Course #3 ](https://www.youtube.com/watch?v=mbP1s2uWFMo) +- [Logical operators in Python are easy ☀️](https://www.youtube.com/watch?v=W7luvtXeQTA) \ No newline at end of file diff --git a/practicals/week9/code.py b/practicals/week9/code.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/practicals/week9/notes.md b/practicals/week9/notes.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/practicals/week9/tasks.md b/practicals/week9/tasks.md new file mode 100644 index 0000000000000000000000000000000000000000..592df3676c240bfbc515a748598ac93632f7785f --- /dev/null +++ b/practicals/week9/tasks.md @@ -0,0 +1,123 @@ +# Week 9 Tasks for practicals + +# Task 1 +## 1.1 + +Just using conditionals and boolean algebra and print statements we can emulate the logic for some systems that might be used in a program. Consider a rudimentary user permissions system for example. + +```python +role = input("Enter your role (student, lecturer, admin): ") + +# Check the role and print out the corresponding permission level +if role == "student": + print("Permission level: Read-only") +elif role == "lecturer": + print("Permission level: Read and write") +elif role == "admin": + print("Permission level: Full access") +else: + print("Invalid role entered!") +``` + +## 1.2 + +Snoop pets is looking to build a compatibility checker for their new GPS trackers which identify which of the their proposed three devices a pet owner should buy. For the following pets write the logic for a system like this. Make use of conditionals and boolean algebra. + +Pets: +> feline, canine, reptile, amphibian, fish, bird, equine + +Products: +#### pet-tracks-L +"The pet-tracks-L is snoop pets large form factor pet tracker, suitable for large pets it is splash resistant" +#### pet-tracks-S +"The pet-tracks-S is snoop pets small form factor pet tracker, suitable for smaller pets it is splash resistant and ultra light weight" +#### pet-tracks-W +"The pet-tracks-W is snoop pets waterproof pet tracker, suitable for full time underwater use in depths up to 5m" + +## 1.3 + +Snoop pets user feedback suggests that users now want to be able to be more specific with their pets. They have provided a new list of pets but want to be able to easily add more pets in the future. The proposed solution is to take the following options and use them to map to the previous solution. You are free to use whatever python concepts you feel are appropriate here, but this is possible using just if/else and simple boolean algebra. + +New input options: +> persian, labrador, guppy, owl, bull dog, finch, gecko, clown fish, pony, skink, newt, maine coon, siamese, poodle, husky, snake, frog, goldfish, parrot, horse + +# Task 2 + +## 2.1 + +We presented a very simple example of a permission system. In some systems we can imagine that more fine grained control is required. + +For Face Off's new e sports league, we can imagine that as they develop they need to provide various features to members of their fast growing team. As new roles are assigned to them they need access to different privileges in addition to those that certain users will have. Examples such as user account management, and team account management should be made available to users and team managers respectively. But other permissions are specific to internal roles at Face Off. Face off organises. + +Here we provide an example for player and team manager permissions, representing the features as a table. + +| | Change own password | Change others passwords | invite to team | +|--------------|---------------------|-------------------------|----------------| +| Player | yes | no | no | +| Team Manager | yes | only same team | yes | + +We can model this scenario in the following style. + +```python +account_type = input('enter your account type ') +team_id = input('enter your team id ') + +#Change own password +if (account_type == "player" or account_type == "team-manager"): + print('you can change your password') + +# Change other password +target_team = input('enter the team id you want to change a password for ') + +if (account_type == "team-manager" and team_id == target_team): + print('you can change that password') +elif (account_type == "team-manager" and team_id != target_team): + print('cant change the password for members of another team') +else: + print('cant change the password of others') + +``` + +Extend this to include a case for team invitation... + +## 2.2 + +In the style above, create a program that prints out the permissions described by the following table: + +| | Change own password | Change others passwords | invite to team | invite to tournament | Ban for hacking | Permission level | +|---------------------------|---------------------|-------------------------|----------------|----------------------|-----------------|------------------| +| Tournament organiser | yes | no | yes | yes | | 2 | +| tournament moderator | yes | no | no | no | yes | 1 | +| Special relations manager | yes | yes | yes | yes | yes | 3 | + + +## 2.3 + +Face Off have managed to engage just over 100 teams since starting. Their premium teams are given the team ids from 1-16. They want to introduce a internal permission level in addition to the permission model provided in 2.2, such that only permission level 3 users and above can make manage premium teams (as a means for quality control). Collect input in for this feature and extend the program from 2.2 to account for this. + +## 2.4 + +Explore the concept of bit masks. Use them to implement a permission system that can toggle individual features on and off by representing users with a bit mask. You may devise your own feature set and optionally make it related the to the scenario of your choice. + +# Task 3 + +Begin by reading and exploring the definitions and examples of [informal fallacies here](https://www.txst.edu/philosophy/resources/fallacy-definitions.html): as discussed in the lecture. + +Explore and discuss (in groups and with your tutor), the following premises and what informal logical fallacies they contain, arguing a case against any of the cases you don't believe to be well formed arguments. +> **Note that these are based on the assignment scenarios** and can be considered as part of the development process and therefore may be documented (likely as part of either the background or the requirements analysis sections). You may therefore **focus on the one related to your assignment**, but **you should also attempt the others** as well if you have time. **Write no more than 100 words on this for your portfolio.** + +## 3.1 + +Tunify involved one of their sponsored artists (a multi platinum pop performer) in the meeting with their board members as they designed their roadmap. They suggested that they only focus their arguments on one of two genres, pop or rock, as these are the most important genres in the charts. +## 3.2 + +The Greenstores think-tank and product design team have been forming their product roadmap based on feedback from consumer surveys and focus groups. They have suggested that the company focus on contributions to the power grid as increasing the amount of electric vehicles on the road with dramatically increase the demand for electricity (with some stating it would need to double overnight). They also emphasised the need for further range in EVs to be practical as they are concerned that the typical 200-300 mile range is not enough. +## 3.3 + +SnoopPets have been planning their roadmap around their planned new advertising campaign. Whilst considering the slogan for the campaign "the new pet tag", this is a poor slogan as they for example, do not put a pet tag on their dog, as most people don't. + +SnoopPets are also considering responses following their first email campaign where one blog post stated that "First they start tracking our pets, then we will be wearing trackers around our necks". +## 3.4 + +Whilst Face Off has had a good start to attracting E sports teams, they are now looking to expand their user base. The CTO has suggested that they have are paying for premium, high performing low latency servers and so they will get new users due to that. +Face Off have also identified a problem with the adverts that lead to their signup page as performing worse than others \ No newline at end of file