Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

How can I make the verb "to be, is/are" agree with plural or singular step(s)?

if we make the word step pluralize itself, we also need to make the verb agree with the plurality. how do we pick "is" for a count of 1 and "are" for count greater than 1?

1 Answer

This should work. First we initialize the verb, then check for the count and assign it the appropriate value. We then use the format function on the string to insert the value of the verb variable into it.

verb = ''
if count==1:    
    verb='is'
elif count>1:
    verb='are'
print('There {} ....'.format(verb))