Skip to content

Instantly share code, notes, and snippets.

View HaydenRU's full-sized avatar

Paul Basov HaydenRU

View GitHub Profile
@HaydenRU
HaydenRU / string2.py
Created June 22, 2012 22:15 — forked from daGrevis/string2.py
PyQuick: String #2
# D. verbing
# Given a string, if its length is at least 3,
# add 'ing' to its end.
# Unless it already ends in 'ing', in which case
# add 'ly' instead.
# If the string length is less than 3, leave it unchanged.
# Return the resulting string.
def verbing(s):
if len(s) < 3:
return s
@HaydenRU
HaydenRU / string1.py
Created June 22, 2012 20:58 — forked from daGrevis/string1.py
PyQuick: String #1
# A. donuts
# Given an int count of a number of donuts, return a string
# of the form 'Number of donuts: <count>', where <count> is the number
# passed in. However, if the count is 10 or more, then use the word 'many'
# instead of the actual count.
# So donuts(5) returns 'Number of donuts: 5'
# and donuts(23) returns 'Number of donuts: many'
def donuts(count):
if count >= 10:
return 'Number of donuts: many'