- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 17
- Posts with Upvotes
- 14
- Upvoting Members
- 11
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
Re:
Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and the display the following data: • The lowest number in the array • The highest number in the array • The total of the numbers in … |
|
Re:
Which is the most popular editor on these forums, please? Especially so, an editor that takes Python to the maximum of what it is capable of achieving. I'm hoping that I won't need such-and-such an editor to do this, and such-and-such an editor to do that... An all-in-one if possible. … |
|
Re:
Hi All, I am a newbie programmer in python and I am trying to read multiple csv files from a folder, perform some data sums based on timestamps for each row for all the csv files and then output the sums to one result csv file. So far I am … |
|
Re:
Which is smarter? class HoldAttr(object): pass a = HoldAttr b = getattr(a, 'attrname', []) b.append(1) setattr(a, 'attrname', b) # or try: b.a.append(1) except AttributeError: b.a = [1] ... or something else? Trying to learn. |
|
Re:
Hi there, I just wanted to ask how I would go about writing a single function to count the frequency of numbers 0-10 including .5(such as 1.5,2.5) This is what I have done file = open ('grade.txt', 'r') s=file.readline() grade=[] while s[0:3]!="EOF": s=s.replace(' ','') lst=s.split(',') if lst[0][0]!='I': grade.append(float(lst[5])) print(lst) s=file.readline() … |
|
Re:
I've been looking for a way to work with polynomials using python, did someone already wrote a code to do that?. Here's what i have until now using dictionaries as polynomials -for example: x^4-6x^2+1 would be {4:1, 2:-6, 0:1}-, someone have any suggestion to make? def degree(f): t = sorted(f.keys()) … |
|
Re:
Hello all. I am very excited to have found this place in that I might better my very shoddy coding skills. I am trying to learn Python with a couple of books and some ideas for programs. I am trying to figure out a matter of what I think is … |
|
Re:
Hi, I'm trying to apply a linear regressipn function to my numpy array and then store the results in a new array. But i have 2 things that are not working for me. def regressioncal(valarray): new_col = [] linregres valarray = numpy.array(valarray) l=20000 for t in xrange(1,5000,10): for j in … |
|
Re:
Can I append a list obtained from a Class as output outside the class , if Yes how ?? can i use userList for this purpose ? |
|
Hi guys, This feels like something that should be possible in Python, and something that I feel like I should know how to do. Image I have a list of numbers: items=[10,20,30] Let's say I wanted iterate over them and define two new variables, a and b. a=[] b=[] for … |
|
Re:
Hi all, I am looking at neat ways of re writing this code below, especially the for loops as I would have over 50 of these statements if I did this the manual way shown below. n = 50 files = [open("files%i.txt" % i, "w") for i in range (n)] … |
|
Re:
Hi, I've just started learning Python and for my first script I wanted to make something that would make life easier and that I would actually use, so starting small I've began working on a Torrent Search script that uses the ISOHunt API. However I've ran into a problem in … |
|
Re:
I am in a Fundamentals of Programming class which we are using Python. In the book was a simple code to solve a problem where a cook knows in cups how much he needs but we are converting it to ounces. I was playing around with that and trying to … |
|
Hi guys, I am running a costly simulation and trying to optimize the output. I'd have a fixed range over which the parameter of interest can vary, and about 100 values it can take in between. We know the result we are looking for and want to find the parameter … |
|
Hi guys, I've downloaded 2 cached_property implementations from the internet and both did not work correctly for my programs. Does anyone here used a cached_property function that works really well and could share with me? |
|
Re:
My pc has been infected by a very harmfull virus , this virus close and restart windows explorer repeatedly in very short time , I cant use the computer, Please help me about the name of this virus and how can I remove it. Thanks in advance |
|
Re:
def main(): celsius = float(input("What is the Celsius temperature? ") fahrenheit = (9/5) * celsius + 32 print ("The temperature is ", fahrenheit, " degrees Fahrenheit.") main() error output: Syntax Error:(line 8) fahrenheit = (9/5) * celsius + 32 This makes perfect sense to me. How can i fix this … |
|
Re:
Hi! I have a beginners problem I really need some help with. First of all, here is my current program: def texten(): filehandle=open ( 'savetonight.txt', 'r' ) text=filehandle.read() return text def smabokstavertext(): texten() print text.lower() I basically want my function smabokstavertext() to call the first function texten() and then print … |
|
Re:
Can anyone HELP me for my problem .. Im a newbie in python ! I want to create a script to rename files in a dir. that dir has 400 files .png .. startswith 001.png , 002.png to 400.png ! I want to rename them startswith 000.png to 399.png .. … |
|
Re:
movies = ["The Holy Grail", 1975, "Terry Jones & Terry Gilliam", 91, ["Graham Chapman", ["Michael Palin", "John Cleese", "Terry Gilliam", "Eric Idle", "Terry Jones"]]] print(movies[4][1][3]) In the above code, how does [4][1][3] result in "Eric Idle"? It looks to me like the 4 selects Eric Idle becaue it's the 4th … |
|
Hi, I'm having some difficulty reading in boolean values from a file, particularly false values. Python can understand false values as empty strings, as well as a few other ways. For example: In [43]: bool(0) Out[43]: False In [44]: bool(False) Out[44]: False In [45]: bool('') Out[45]: False The problem is, … |
|
Re:
can anyone give simple example of storing data in datastore in google apps engine using python . thnx |
|
Hi, I am trying to create the most general function possible to test if an object passed into it has mutability or not. With some prior help from pytony, it seemed that the best way to do this is to try to set and attribute. If the attribute can be … |
|
Re:
I have a text file that contains something like this: # Comment # Comment # Comment # Comment # Comment Comment # Comment #Raw SIFs at Crack Propagation Step: 0 # Vertex, X, Y, Z, K_I, K_II, K_III, 0 , 2.100000e+00 , 2.000000e+00 , -1.000000e-04 , 0.000000e+00 , 0.000000e+00 , … |
|
Re:
Here is slow brute force way to find the largest palindromic product of three digit integers. You could do loop and break out of it if you go under the smaller number (the second one) of best solution found so far to be more efficient etc. |
|
Re:
Hi guys, With Python, I am using genfromtxt (from numpy) to read in a text file into an array: `y = np.genfromtxt("1400list.txt", dtype=[('mystring','S20'),('myfloat','float')])` Which works okay, except it doesn't seem to read my 2 columns into a 2D array. I am getting: [('string001', 123.0),('string002', 456.0),('string002', 789.0)] But I think would … |
|
Re:
So, maybe this is a concept out of the domain of programming... but I think not. Lets say we have a 400MB video file that we want to either send somewhere, or stream. Can we use python to break it into binary, break the binary into chunks, and then send … |
|
Re:
Hi, I'm new to Python. Can someone please guide me in writing a Python script that bulk processes audio files and image files to create an audiovisual or movie out of them. Say we have 20 images and 20 audio files and want to create 20 video files out of … |
|
Re:
I'm trying to open a tex file from within python, tell the tex editor to run (manually you would press ctrl + T) and finally close the program. So far I can only figure out how to open and close the program. this is what I have so far... os.spawnv(os.P_WAIT, … |
|
Re:
So far, I think I'm doing it right however it doesn't seem to generate the results I wanted. def occurrence(e,List): for item in List: s = 0 if item == e: s += 1 return s Basically I want my function to count how many times e occurs in List. … |