Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to split the total amount equally among all participants.
LLD
share = total_amount [1] number_of_participants Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of division.
Using addition or subtraction which does not split the amount.
✗ Incorrect
To split equally, divide the total amount by the number of participants.
2fill in blank
mediumComplete the code to assign an exact amount to a participant.
LLD
participant_share = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using division or percentage calculations instead of fixed amount.
Subtracting amounts which is incorrect here.
✗ Incorrect
Exact split means assigning a fixed amount directly.
3fill in blank
hardFix the error in the code to calculate participant share by percentage.
LLD
participant_share = total_amount [1] percentage Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using division or addition instead of multiplication.
Using subtraction which reduces the amount incorrectly.
✗ Incorrect
To calculate share by percentage, multiply total amount by the percentage.
4fill in blank
hardFill both blanks to create a dictionary comprehension for exact splits.
LLD
splits = {participant: [1] for participant, [2] in exact_amounts.items()} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect variable names that do not match the dictionary items.
Confusing keys and values in the comprehension.
✗ Incorrect
Use 'value' as the value and the variable from items() for clarity.
5fill in blank
hardFill all three blanks to calculate percentage splits and store in a dictionary.
LLD
percentage_splits = {participant: total_amount [1] [2] for participant, [3] in percentages.items()} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using division instead of multiplication.
Using wrong variable names for the percentage value.
✗ Incorrect
Multiply total amount by the value (percentage) from the dictionary.