Detailed Overview of Python Tasks in the Deloitte Online Assessment – OA 代写 – OA help

Task 1

Objective:
The objective of the task is to write a function to clean data in Python.

Requirements:

  1. Convert 'value' to a float. Handle non-numeric values gracefully (e.g., replace with NaN or 0).
  2. Replace missing 'category' values with 'Unknown'.
  3. Return a list of cleaned dictionaries.

Examples:
Example Input:

data = [
    {'id': 1, 'value': '10', 'category': 'A'},
    {'id': 2, 'value': '20.5', 'category': 'B'},
    {'id': 3, 'value': 'abc', 'category': 'A'},
    {'id': 4, 'value': '30', 'category': None},
]

Task 2

Objective:
The objective of the task is to write a function to manipulate a string in Python.

Requirements:
Write a function that takes a string as input and returns the number of times a specific substring appears within the string, ignoring case. The function should be efficient for large strings.

Examples:

  • input = "This is a test string. This is another test."
    substring = "test"
    The function should return 2.
  • input = "apple APPLE Apple"
    substring = "apple"
    The function should return 3.

Task 3

Objective:
The objective of the task is to write a function to clean data in Python.

Requirements:
You are given a dictionary representing data from a sensor. Some sensor readings might be missing (represented by None).
Write a function that calculates the average of the sensor readings (integer or float), handling missing data gracefully.
The function should return the average as a float. If no valid readings exist, return 0.0.
Some data might be in a string format, which should be interpreted as a numerical value if possible. Any other data types apart from int, float and string should be discarded.

Notes:

  • The function should be able to handle any key label values - the key labels can have any value.
  • Round your values to a single decimal place.

Examples:

sensor_data = {'reading1': 10, 'rdg2': None, 'reading3': 15, 'reading4': 20}
# Function should return 15.0

sensor_data = {'reading1': None, 'reading2': '2', 'reading3': None}
# Function should return 2.0

Task 4

Objective:
Write a function that parses a JSON string.
The function should handle one of the three errors below:

  • Invalid JSON: The input string is not valid JSON.
  • Missing keys: The JSON object is missing expected keys. Case sensitive.
  • Incorrect data types: The values associated with keys have unexpected data types.

Schema:
The JSON should have the keys:

  • "food" (string)
  • "category" (string value of either "Asian" or "Western")
  • "price" (integer)

Return:
The function should return a dictionary containing the parsed data if successful, or a string error message specifying exactly (case insensitive) one of the 3 categories of errors above.

Possible error strings:

  • "Invalid JSON"
  • "Missing keys"
  • "Incorrect data types"

Note:
Each test will only have one error, so don’t worry about ordering which error should take precedence.

我们长期稳定承接各大科技公司如TikTok、Uber、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

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