Bird
0
0

How do you correctly combine two string variables city and country with a comma and space in LCEL?

easy📝 Syntax Q3 of 15
LangChain - Chains and LCEL
How do you correctly combine two string variables city and country with a comma and space in LCEL?
Acity . ', ' . country
Bconcat(city, ', ', country)
Ccity & ', ' & country
Dcity + ', ' + country
Step-by-Step Solution
Solution:
  1. Step 1: Understand string concatenation in LCEL

    LCEL uses the + operator to concatenate strings.
  2. Step 2: Combine variables with literal string

    To add a comma and space between city and country, include it as a string: ', '.
  3. Final Answer:

    city + ', ' + country -> Option D
  4. Quick Check:

    Check if + is used for concatenation and literals are quoted [OK]
Quick Trick: Use + operator for string concatenation in LCEL [OK]
Common Mistakes:
  • Using functions like concat() which LCEL does not support
  • Using & or . operators which are not valid in LCEL
  • Not quoting the comma and space as a string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes