Skip to content

Instantly share code, notes, and snippets.

@fsouza
Created November 17, 2010 21:13
Show Gist options
  • Save fsouza/704095 to your computer and use it in GitHub Desktop.
Save fsouza/704095 to your computer and use it in GitHub Desktop.
#coding:utf-8
"""Implementação do exercício de composição do livro Aprenda Computação com Python.
Enunciado disponível em: http://www.franciscosouza.com.br/aprendacompy/capitulo_05.html#composicao
"""
def coeficienteAngular(x1, y1, x2, y2):
return float(y2 - y1) / (x2 - x1)
def cortaY(x1, y1, x2, y2):
coeficiente = coeficienteAngular(x1, y1, x2, y2)
return coeficiente * x1 * -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment