Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:54:25+00:00 2026-06-11T22:54:25+00:00

In my textbook I came across this example: lower = (lambda x, y: x

  • 0

In my textbook I came across this example:

lower = (lambda x, y: x if x < y else y)
print(lower ('bb','aa'))

So far I used

if_stmt ::=  "if" expression ":" suite
         ( "elif" expression ":" suite )*
         ["else" ":" suite]

So, this ‘x if x < y else y’ astonished me a bit.
Could you direct me: where in the documentation can I find this construction?

Thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:54:26+00:00Added an answer on June 11, 2026 at 10:54 pm

    So they are called “Conditional Expressions” and you can find them in the python 3 docs a longer clearer explanation can be found in this section of of the 2.5 docs. I use it a lot for conditional assignment like:

    level = 1 if logging else 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working through Learning Python came across factory function. This textbook example works: def maker(N):
I am a beginning programmer and came across this in my textbook: public boolean
I was reading a textbook and I came across this line. It seems to
I came across this in a computer architecture textbook: Subtracting a strictly negative integer
I came across an interesting question in my textbook, but not further answer or
I'm following this awful textbook, going through the basics of create/edit/delete records. The delete
I've looked around online as well as in my textbook and this is confusing
I have a modified textbook example as follows (the book is Understanding Ada---a software
I've come across these in a textbook I am reading on C#, but I
This is my first use of jquery outside of a textbook so of course

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.