by **workhorse** » Fri Jan 31, 2014 6:36 pm

I created this simple script to read a file containing two numbers, and calculate the hypotenuse of a right angle triangle.

- Code: Select all
`##open and read the file, then split both integers`

f = open ('rosalind_ini2 (1).txt', "rt")

line =f.read()

values = line.split()

##store both integers and calculate hypotenuse.

x1 = int(values[0])

x2 = int(values[1])

hyp = x1**2 + x2**2

print hyp**1/2

Last edited by

stranac on Fri Jan 31, 2014 7:52 pm, edited 1 time in total.

**Reason:** *Moved from tutorial submissions. This really doesn't belong there.*