Changes between Version 26 and Version 27 of python


Ignore:
Timestamp:
Dec 4, 2011, 10:19:12 PM (13 years ago)
Author:
Leon Kos
Comment:

Podaj rešitev za vajo43, ki ima datoteko.

Legend:

Unmodified
Added
Removed
Modified
  • python

    v26 v27  
    554554{{{
    555555#!python
    556    print "%4.1f %4.1f %4.1f %4.1f %4.1f "  % ( p0[2*i], p0[2*i+], p1[2*i], p1[2*i+1], q[i]  )
     556   print "%4.1f %4.1f %4.1f %4.1f %4.1f "  % ( p0[2*i], p0[2*i+1], p1[2*i], p1[2*i+1], q[i]  )
    557557}}}
    558558prve in druge točke elementa ter q.
     559
     560Rešitev:
     561{{{
     562#!python
     563f= open("vaja43.dat", "r")
     564lines = f.readlines()
     565n, div = [eval(s) for s in lines[0].split(" ")]
     566print n,div
     567p0 = []
     568p1 = []
     569q = []
     570for i in range(8):
     571    x0,y0,x1,y1,qi=[eval(s) for s in lines[1+i].split(" ")]
     572    p0.append(x0)
     573    p0.append(y0)
     574    p1.append(x1)
     575    p1.append(y1)
     576    q.append(qi)
     577    print "%4.1f %4.1f %4.1f %4.1f %4.1f "  % ( p0[2*i], p0[2*i+1], p1[2*i], p1[2*i+1], q[i]  )
     578f.close()
     579}}}
    559580
    560581== vaja44 ==