I would like to create a string that uses a plural if count > 1.
For that, I would like have an “inline” condition that returns ‘s’ to concatenate to my noun.
print "The plural of plural is plural{0}. {1}".format( {'s' if count > 1}, "Isnt't it!?")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You need to add the else part to the
's' if count > 1otherwise this is not a valid expression (because the value to return whencount <= 1has not been specified and Python cannot guess what this should be):