Challenge - 5 Problems
LCEL Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate1:30remaining
What is the output of this LCEL expression?
Given the LCEL expression
"Hello, {user.name}! Today is {date.today()}", what will be the output if user.name is "Alice" and today's date is 2024-06-15?Attempts:
2 left
💡 Hint
LCEL replaces expressions inside curly braces with their evaluated values.
✗ Incorrect
LCEL evaluates expressions inside curly braces. Here, {user.name} becomes 'Alice' and {date.today()} returns the current date '2024-06-15'.
📝 Syntax
intermediate1:30remaining
Which LCEL expression is syntactically correct?
Choose the LCEL expression that is valid and will not cause a syntax error.
Attempts:
2 left
💡 Hint
Check for balanced braces and complete expressions inside curly braces.
✗ Incorrect
Option A has a complete expression inside balanced braces. Options A, B, and C have syntax errors due to incomplete or unbalanced braces.
❓ state_output
advanced2:00remaining
What is the value of variable
result after evaluating this LCEL expression?Given variables
a = 5 and b = 3, what is the value of result after evaluating "{a > b ? 'a is greater' : 'b is greater or equal'}"?Attempts:
2 left
💡 Hint
LCEL supports ternary expressions inside curly braces.
✗ Incorrect
Since a (5) is greater than b (3), the condition is true, so the expression returns 'a is greater'.
🔧 Debug
advanced2:00remaining
Which option causes a runtime error when evaluating this LCEL expression?
Consider the LCEL expression
"User age: {user.age}". Which option will cause a runtime error if user does not have an age property?Attempts:
2 left
💡 Hint
Check how missing properties are accessed safely in LCEL.
✗ Incorrect
Option C tries to access a missing property directly, causing a runtime error. Options B, C, and D use safe access or default values to avoid errors.
🧠 Conceptual
expert2:30remaining
How many items are in the resulting list after evaluating this LCEL expression?
Given
numbers = [1, 2, 3, 4], what is the length of the list produced by [n * 2 for n in numbers if n % 2 == 0] in LCEL?Attempts:
2 left
💡 Hint
Filter numbers that are even, then multiply by 2.
✗ Incorrect
Only 2 and 4 are even in the list, so the resulting list has 2 items: [4, 8].