I need ur help /u/TopMandemG Python Education

I recently had an exam in python where a task similar to the one I’m sharing counted for 50% of the grade. Unfortunately, I didn’t pass, and I have a similar exam coming up soon. I’m looking for advice on:

  1. Effective strategies to tackle these types of problems
  2. Recommended YouTube videos or online resources
  3. Methods to better understand and learn this material
  4. Study techniques, considering I can bring written notes to the exam

Any tips or guidance would be greatly appreciated. Should I just practice more problems, or are there specific approaches I should consider?

Under here i will paste the task i got on my exam – the next exam has this same type of structure just in another context.

Here is the whole problem that counted 50% of my exam (Keep in mind this exam was in norwegian and i used ai to translate it):
Exercise 4. Streaming Service (50 points)

In this task, you will create a first version of a simple streaming service. The streaming service offers subscribers a variety of different series. Each series has one or more episodes .To make it easier for subscribers to find series they like, the service uses tags. A tag says something about the content of an episode. Examples of tags are “comedy”, “documentary”, and “drama”.Each episode can have multiple tags. Together, the tags on all episodes in the series describe what kind of content the series has, and how much of different types of content there is.When a new subscriber is created, the subscriber must specify their preferences. For each existing tag, the service asks if the subscriber likes series with this type of content, is neutral to the content, or dislikes the content.The service can thus suggest series that suit a subscriber by calculating a match between the subscriber’s preferences and the tags on the various series.Remember that you can use classes and methods from a previous subtask even if you haven’t answered it. Use class and method names as given in the task text (names in bold).

4a) 6 points

Write the Subscriber class with constructor. The constructor has parameters for subscriber name (string) and preferences (dictionary described later in the task). Instance variables:

  • subscriber name (string)
  • preferences (the dictionary that is a parameter to the constructor)
  • started series (dictionary where series name is key, last episode number the subscriber has watched is value)

Also write the methods:

  • get_preferences. Returns the dictionary with the subscriber’s preferences.
  • check_if_watched. The method has a parameter series name (string). It returns True if the subscriber has watched one or more episodes of the series, otherwise False.
  • watch_an_episode The method has a parameter series name, and adds a new series or updates the episode number for the series if it’s already started.

4b) 4 points

Write the Series class with constructor. The constructor has a parameter series name. It calls the helper method _read_from_file which reads episodes and tags from file (see next subtask). Instance variables:

  • series name
  • episodes in the series (dictionary with episode number as key, list of tags as value)
  • tags in the series (dictionary where tag is key, number of episodes with the tag is value)

4c) 10 points

Extend the Series class with the methods:

  • _read_from_file. The method has no parameters (other than self) or return value. It reads a file with the same name as the series followed by “.txt”. Each line in this file contains tags for one episode, separated by spaces. On line 1 are tags for episode 1, on line 2 for episode 2, etc. The method adds each episode with tags and updates which tags exist for the series.
  • get_series_tags. The method returns all tags associated with the series as a list.

4d) 10 points

Write the Service class with constructor. The constructor has a parameter for a list of series names. Instance variables:

  • series the service offers (dictionary where series name is key)
  • tags in use in the service (list of strings)
  • subscribers (dictionary where subscriber name is key, reference to subscriber is value)

The constructor creates a Series object for each of the series names and stores these in the dictionary of series. The tags in the series are added to the service if they are not already registered.

4e) 10 points

Also write the following method in the Service class:

  • new_subscriber. The method has no parameters or return value. It asks for and reads the subscriber’s name, and preferences for each individual tag in the service from the terminal. The preferences are stored in a dictionary where tag is key, value is -1 (dislikes) or 1 (likes). If the user gives a preference other than -1, 0, or 1 for a tag, the method should ask for a new value until the user gives valid input. Tags the subscriber is neutral to (0) are not included in the preferences dictionary. A new subscriber with name and preferences is created and added to the service.

4f) 5 points

You will now extend the Series and Service classes with methods that make it possible to suggest series for a subscriber based on the subscriber’s preferences.Extend the Series class with the method:

  • calculate_match. The method has a parameter for a subscriber’s preferences (same as in the Subscriber class) and returns an integer indicating how well this series matches these. If the series doesn’t have any of the tags in the preferences, the match =0=0. If there are more tags the subscriber likes, the match should be a positive number; if there are more tags the subscriber dislikes, the match should be a negative number. Take into account how many episodes the tags appear in.

4g) 5 points

Extend the Service class with the following method:

  • suggest_series. The method has a parameter that specifies the subscriber name, and calculates a match between each series and the subscriber’s preferences using the calculate_match method. The method only suggests series the subscriber hasn’t watched before, and which have a match >0>0. If no series satisfy these requirements, the method prints a message about this; otherwise, it prints out the names of the suggested series

submitted by /u/TopMandemG
[link] [comments]

​r/learnpython I recently had an exam in python where a task similar to the one I’m sharing counted for 50% of the grade. Unfortunately, I didn’t pass, and I have a similar exam coming up soon. I’m looking for advice on: Effective strategies to tackle these types of problems Recommended YouTube videos or online resources Methods to better understand and learn this material Study techniques, considering I can bring written notes to the exam Any tips or guidance would be greatly appreciated. Should I just practice more problems, or are there specific approaches I should consider? Under here i will paste the task i got on my exam – the next exam has this same type of structure just in another context. Here is the whole problem that counted 50% of my exam (Keep in mind this exam was in norwegian and i used ai to translate it): Exercise 4. Streaming Service (50 points) In this task, you will create a first version of a simple streaming service. The streaming service offers subscribers a variety of different series. Each series has one or more episodes .To make it easier for subscribers to find series they like, the service uses tags. A tag says something about the content of an episode. Examples of tags are “comedy”, “documentary”, and “drama”.Each episode can have multiple tags. Together, the tags on all episodes in the series describe what kind of content the series has, and how much of different types of content there is.When a new subscriber is created, the subscriber must specify their preferences. For each existing tag, the service asks if the subscriber likes series with this type of content, is neutral to the content, or dislikes the content.The service can thus suggest series that suit a subscriber by calculating a match between the subscriber’s preferences and the tags on the various series.Remember that you can use classes and methods from a previous subtask even if you haven’t answered it. Use class and method names as given in the task text (names in bold). 4a) 6 points Write the Subscriber class with constructor. The constructor has parameters for subscriber name (string) and preferences (dictionary described later in the task). Instance variables: subscriber name (string) preferences (the dictionary that is a parameter to the constructor) started series (dictionary where series name is key, last episode number the subscriber has watched is value) Also write the methods: get_preferences. Returns the dictionary with the subscriber’s preferences. check_if_watched. The method has a parameter series name (string). It returns True if the subscriber has watched one or more episodes of the series, otherwise False. watch_an_episode The method has a parameter series name, and adds a new series or updates the episode number for the series if it’s already started. 4b) 4 points Write the Series class with constructor. The constructor has a parameter series name. It calls the helper method _read_from_file which reads episodes and tags from file (see next subtask). Instance variables: series name episodes in the series (dictionary with episode number as key, list of tags as value) tags in the series (dictionary where tag is key, number of episodes with the tag is value) 4c) 10 points Extend the Series class with the methods: _read_from_file. The method has no parameters (other than self) or return value. It reads a file with the same name as the series followed by “.txt”. Each line in this file contains tags for one episode, separated by spaces. On line 1 are tags for episode 1, on line 2 for episode 2, etc. The method adds each episode with tags and updates which tags exist for the series. get_series_tags. The method returns all tags associated with the series as a list. 4d) 10 points Write the Service class with constructor. The constructor has a parameter for a list of series names. Instance variables: series the service offers (dictionary where series name is key) tags in use in the service (list of strings) subscribers (dictionary where subscriber name is key, reference to subscriber is value) The constructor creates a Series object for each of the series names and stores these in the dictionary of series. The tags in the series are added to the service if they are not already registered. 4e) 10 points Also write the following method in the Service class: new_subscriber. The method has no parameters or return value. It asks for and reads the subscriber’s name, and preferences for each individual tag in the service from the terminal. The preferences are stored in a dictionary where tag is key, value is -1 (dislikes) or 1 (likes). If the user gives a preference other than -1, 0, or 1 for a tag, the method should ask for a new value until the user gives valid input. Tags the subscriber is neutral to (0) are not included in the preferences dictionary. A new subscriber with name and preferences is created and added to the service. 4f) 5 points You will now extend the Series and Service classes with methods that make it possible to suggest series for a subscriber based on the subscriber’s preferences.Extend the Series class with the method: calculate_match. The method has a parameter for a subscriber’s preferences (same as in the Subscriber class) and returns an integer indicating how well this series matches these. If the series doesn’t have any of the tags in the preferences, the match =0=0. If there are more tags the subscriber likes, the match should be a positive number; if there are more tags the subscriber dislikes, the match should be a negative number. Take into account how many episodes the tags appear in. 4g) 5 points Extend the Service class with the following method: suggest_series. The method has a parameter that specifies the subscriber name, and calculates a match between each series and the subscriber’s preferences using the calculate_match method. The method only suggests series the subscriber hasn’t watched before, and which have a match >0>0. If no series satisfy these requirements, the method prints a message about this; otherwise, it prints out the names of the suggested series submitted by /u/TopMandemG [link] [comments] 

I recently had an exam in python where a task similar to the one I’m sharing counted for 50% of the grade. Unfortunately, I didn’t pass, and I have a similar exam coming up soon. I’m looking for advice on:

  1. Effective strategies to tackle these types of problems
  2. Recommended YouTube videos or online resources
  3. Methods to better understand and learn this material
  4. Study techniques, considering I can bring written notes to the exam

Any tips or guidance would be greatly appreciated. Should I just practice more problems, or are there specific approaches I should consider?

Under here i will paste the task i got on my exam – the next exam has this same type of structure just in another context.

Here is the whole problem that counted 50% of my exam (Keep in mind this exam was in norwegian and i used ai to translate it):
Exercise 4. Streaming Service (50 points)

In this task, you will create a first version of a simple streaming service. The streaming service offers subscribers a variety of different series. Each series has one or more episodes .To make it easier for subscribers to find series they like, the service uses tags. A tag says something about the content of an episode. Examples of tags are “comedy”, “documentary”, and “drama”.Each episode can have multiple tags. Together, the tags on all episodes in the series describe what kind of content the series has, and how much of different types of content there is.When a new subscriber is created, the subscriber must specify their preferences. For each existing tag, the service asks if the subscriber likes series with this type of content, is neutral to the content, or dislikes the content.The service can thus suggest series that suit a subscriber by calculating a match between the subscriber’s preferences and the tags on the various series.Remember that you can use classes and methods from a previous subtask even if you haven’t answered it. Use class and method names as given in the task text (names in bold).

4a) 6 points

Write the Subscriber class with constructor. The constructor has parameters for subscriber name (string) and preferences (dictionary described later in the task). Instance variables:

  • subscriber name (string)
  • preferences (the dictionary that is a parameter to the constructor)
  • started series (dictionary where series name is key, last episode number the subscriber has watched is value)

Also write the methods:

  • get_preferences. Returns the dictionary with the subscriber’s preferences.
  • check_if_watched. The method has a parameter series name (string). It returns True if the subscriber has watched one or more episodes of the series, otherwise False.
  • watch_an_episode The method has a parameter series name, and adds a new series or updates the episode number for the series if it’s already started.

4b) 4 points

Write the Series class with constructor. The constructor has a parameter series name. It calls the helper method _read_from_file which reads episodes and tags from file (see next subtask). Instance variables:

  • series name
  • episodes in the series (dictionary with episode number as key, list of tags as value)
  • tags in the series (dictionary where tag is key, number of episodes with the tag is value)

4c) 10 points

Extend the Series class with the methods:

  • _read_from_file. The method has no parameters (other than self) or return value. It reads a file with the same name as the series followed by “.txt”. Each line in this file contains tags for one episode, separated by spaces. On line 1 are tags for episode 1, on line 2 for episode 2, etc. The method adds each episode with tags and updates which tags exist for the series.
  • get_series_tags. The method returns all tags associated with the series as a list.

4d) 10 points

Write the Service class with constructor. The constructor has a parameter for a list of series names. Instance variables:

  • series the service offers (dictionary where series name is key)
  • tags in use in the service (list of strings)
  • subscribers (dictionary where subscriber name is key, reference to subscriber is value)

The constructor creates a Series object for each of the series names and stores these in the dictionary of series. The tags in the series are added to the service if they are not already registered.

4e) 10 points

Also write the following method in the Service class:

  • new_subscriber. The method has no parameters or return value. It asks for and reads the subscriber’s name, and preferences for each individual tag in the service from the terminal. The preferences are stored in a dictionary where tag is key, value is -1 (dislikes) or 1 (likes). If the user gives a preference other than -1, 0, or 1 for a tag, the method should ask for a new value until the user gives valid input. Tags the subscriber is neutral to (0) are not included in the preferences dictionary. A new subscriber with name and preferences is created and added to the service.

4f) 5 points

You will now extend the Series and Service classes with methods that make it possible to suggest series for a subscriber based on the subscriber’s preferences.Extend the Series class with the method:

  • calculate_match. The method has a parameter for a subscriber’s preferences (same as in the Subscriber class) and returns an integer indicating how well this series matches these. If the series doesn’t have any of the tags in the preferences, the match =0=0. If there are more tags the subscriber likes, the match should be a positive number; if there are more tags the subscriber dislikes, the match should be a negative number. Take into account how many episodes the tags appear in.

4g) 5 points

Extend the Service class with the following method:

  • suggest_series. The method has a parameter that specifies the subscriber name, and calculates a match between each series and the subscriber’s preferences using the calculate_match method. The method only suggests series the subscriber hasn’t watched before, and which have a match >0>0. If no series satisfy these requirements, the method prints a message about this; otherwise, it prints out the names of the suggested series

submitted by /u/TopMandemG
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *