Skip to content

TOM READS

Self-Improvement, Books, Philosophy of Everyday Life

  • Home
  • Book Reviews
  • Commonplace
  • What I’m doing now
  • About Me
  • Socials
  • More
    • Back

Python 3 Syntax – Udacity

Posted bytomreads February 3, 2018February 4, 2018
def readable_timedelta(days):
    """Print the number of weeks and days in a number of days."""
    #to get the number of weeks we use integer division
    weeks = days // 7
    #to get the number of days that remain we use %, the modulus operator
    remainder = days % 7
    return "{} week(s) and {} day(s)".format(weeks, remainder)





Posted bytomreadsFebruary 3, 2018February 4, 2018Posted inAll Posts, UdacityTags: Python, Udacity

Post navigation

Previous Post Previous post:
The One Sentence Persuasion Course
Next Post Next post:
Introduction to the Python Standard Library – Udacity
TOM READS, Proudly powered by WordPress.