Sponsored By

davalend

Members
  • Content Count

    14
  • Joined

  • Last visited

About davalend

  • Rank
    Member
  1. davalend

    Summation Code

    the language is python
  2. davalend

    Summation Code

    How to write the code for summation of alist of number eg ( 0, 1, 2, 3, 4) it means (0)+(0 + 1)+(0+1+2)+(0+1+2+3)+(0+1+2+3+4) tks
  3. davalend

    Current Time

    how to write the code to display the current time ?
  4. davalend

    Retrieve A Data In A File

    hmm.... because i am using this number in "a" in a formula. for example: x = a * 100 so x will return me a list of difference answer with difference input of "a" get what i mean?
  5. davalend

    Retrieve A Data In A File

    read = open('rules.txt', 'r') a = read.readlines() arr = [] for ruleline in a: arr.append(ruleline.split()[1]) print arr ----------------------------------- ['5510/2'] ['5510/2', '2490/1'] ['5510/2', '2490/1', '4728/2'] ['5510/2', '2490/1', '4728/2', '1940/1'] ['5510/2', '2490/1', '4728/2', '1940/1', '1940/1'] ['5510/2', '2490/1', '4728/2', '1940/1', '1940/1', '5510/3'] --------------------------------------------------------------- it keeps repeating. how come?
  6. davalend

    Retrieve A Data In A File

    tks so much for the quick reply. ya. i done it
  7. davalend

    Retrieve A Data In A File

    Sorry, i dont get what u mean ... which part of my coding is wrong? and how shd it be change?
  8. davalend

    Retrieve A Data In A File

    read = open('sample.txt', 'r') a = read.readlines() arr = [] for ruleline in a: for ruledata in ruleline[2:9]: arr.append(ruledata) print arr, what is wrong with this code? it prints ['5'] ['5', '5'] ['5', '5', '1'] ['5', '5', '1', '0'] ['5', '5', '1', '0', '/'] ['5', '5', '1', '0', '/', '2'] ['5', '5', '1', '0', '/', '2', ' '] ..... what I want is 5510/2, not seperating them... pls guide me.
  9. davalend

    Retrieve A Data In A File

    1 5510/2 if then Date = 03/17/1999 03/18/1999 2 2490/1 if DA0=100 then DA1 = 112 3 4728/2 if F2=.AP then F1 = .S .AS i have this data in a txt file. now i need to retrieve 5510/2, 2490/1, 4728/2 ONLY. how do i do that in python?
  10. davalend

    Anyone Here Who Is Know Both Python And C++ ?

    now i got other problem. t = len(a) * 0.6 t will definitly be a decimal. how can i change it to the whole number without the decimal, so that i can apply to n in foo[m:n]. n has to be integer
  11. davalend

    Anyone Here Who Is Know Both Python And C++ ?

    this is my python code ---------------------------------- read = open('sample.txt', 'r') a = read.readlines() for line in a : print line, ------------------------------------ the above code will print all the line in the file. but if i wan it to print only certain % of the line(for example: 50% of the line). how do i code it?
  12. davalend

    Anyone Here Who Is Know Both Python And C++ ?

    i need some help with some c++ coding. i need to convert c++ coding to python. anyone can help me?