Advertisement
here2share

# plural.py

May 26th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. # plural.py
  2.  
  3. # add an 's' to indicate plural when k is not 1
  4. for k in range(1, 4):
  5.     print "This loop ran %d time%s" % (k, 's'*(k != 1))
  6.  
  7. """
  8. The for loop ran 1 time
  9. The for loop ran 2 times
  10. The for loop ran 3 times
  11. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement