davalend
Members-
Content Count
14 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Everything posted by davalend
-
the language is python
-
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
-
how to write the code to display the current time ?
-
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?
-
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?
-
tks so much for the quick reply. ya. i done it
-
Sorry, i dont get what u mean ... which part of my coding is wrong? and how shd it be change?
-
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.
-
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?
-
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
-
tks
-
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?
-
i need some help with some c++ coding. i need to convert c++ coding to python. anyone can help me?