15,190 Topics

Member Avatar for
Member Avatar for beck4456

I'm trying to write a program that takes a string and prints one letter per line. I need to use a while loop based on string length. I googled, so sorry for the newbie question. Thanks!

Member Avatar for JoshuaBurleson
0
1K
Member Avatar for sonicx

I'm trying to find max and min values from a text file which contains data in rows and columns. But I want to create a script which will skip the first couple of lines and calculate the max and min from there on. I am aware for the max and …

Member Avatar for woooee
0
14K
Member Avatar for terry_bogart

Not sure how to do this I tried googling it but to no avail. I want to print out a specific line in my while loop [CODE]450 42.5 16625.0 460 42.0 16820.0 470 41.5 17005.0 480 41.0 17180.0 490 40.5 17345.0 500 40.0 17500.0 [/CODE] example of part of my …

Member Avatar for JoshuaBurleson
0
148
Member Avatar for effBlam

I am making a program that analyzes text from a user After inputting several line and using the keyword "DONE", the program will ask for one of 8 possible options which is the menu() function where the user will enter the number. How would i be able to run my …

Member Avatar for JoshuaBurleson
0
211
Member Avatar for effBlam

Im trying to find the first element in each nested list: x = [['hey','wassup'],['are','you','ok'],['i','am','fine'] So that I get print a string: "hw ayo iaf" so far I have: def first_letters(): x = [['hey','wassup'],['are','you','ok'],['i','am','fine'] Thanks!

Member Avatar for Gribouillis
0
91
Member Avatar for effBlam

Im trying to get the last element in each nested list such as double list = [['Hello','how','are','you'],['I','am','fine'],['How','about','yourself']] so that it will print out ['you','fine','yourself] I am also trying to do this all under a function such as def last_words(): #where my double_list is already in this function Thank you!

Member Avatar for Gribouillis
0
89
Member Avatar for nered

[CODE] maxHList = [(5,3),(7,4),(9,5)] totalH = 0 maxH = 0 x = 0 while x < len(maxHList): totalH = math.sqrt(pow(maxHList[x+1][0] - maxHList[x][0],2) + pow(maxHList[x+1][1] - maxHList[x][1],2)) maxH += totalH x += 1 [/CODE] I am going +1 over the list length and i get this error but if i say …

Member Avatar for Gribouillis
0
93
Member Avatar for geekman89

Please, please explain to me why this is giving me an error: [CODE]class bvo: C = 'Hello' def getC(self): return self.C bvo.getC()[/CODE]

Member Avatar for geekman89
0
145
Member Avatar for KenGreen

In an earlier post, Tech-B stated that, other then dialogs, there wasn't 'any "real" GUI support' in Python that uses the Android SDK or SL4A/SAE. Has anyone tried Jython with the Android SDK?

Member Avatar for Tech B
0
373
Member Avatar for sofia85

Hi, I don't understand how to write unix shell commands in python. I have this txt file were I want to delete duplicates. It looks something like this: RTGR.txt FRTO.txt RTGR.txt SDOP.txt QWJL.txt SDOP.txt FRTO.txt FRTO.txt ...etcetc... I think I'm suppose to import os and then I want to use …

Member Avatar for sofia85
0
141
Member Avatar for Tcll

ok for one... I must say I'm a noob at classes, but have made some pretty good apps using nothing but functions. I'd like to get into classes though, and every time I try, I end up misunderstanding 1 or 2 things and messing the whole thing up... <:\ can …

Member Avatar for Tcll
0
161
Member Avatar for giancan

Hi guys, I have a difficult problem to solve. I have a list with 4 columns of values as follow 750.633 379.039 652.524 1112.63 930.491 452.16 842.753 1191.78 882.063 446.411 787.56 1183.43 434.362 410.174 325.863 1145.34 954.426 445.297 865.449 1183.74 1233.67 194.909 1155.27 908.305 1505.97 917.95 1441.07 1698.01 852.882 133.219 …

Member Avatar for Gribouillis
0
291
Member Avatar for Cupidvogel

Hi, I find in all books and websites that in order to run a Python script from the command prompt, I have to run something like this [CODE]python example.py 1.3[/CODE] where [B]example.py[/B] script is provided with an argument of 1.3. However, it is not working for me in Windows 7 …

Member Avatar for TrustyTony
0
299
Member Avatar for MegaMan15

Hello all. So I am trying to write a program that will read in a text file, then it will scan the file for prompts, such as %[color], %[noise], etc. Then from what prompts are within that file, the program will ask the user what word they would like to …

Member Avatar for Gribouillis
0
114
Member Avatar for Wilha

My goal is to output monthly cost insrance for entered employee id, but my program keeps giving me a error idk why [CODE]import sys #empfile=raw_input("Enter Emp.file Name:") #emp=sys.argv[1] #print emp #usage : run it as follows from command line. #python db.py employee.txt InsurancePlans.txt InsurancePolicies.txt def dict2(lines): dict={} for l in …

0
84
Member Avatar for paraclete

I'm having difficulties splitting up a string (that I read from a textfile) into three parts in a list (that I will then use in a function). The issue I'm having is that the 3rd element of the string is not always one word (sometimes its multiple words, but I …

Member Avatar for Gribouillis
0
143
Member Avatar for jayjay85

i need to use crossfade function to to this. i need some help please, i am new at this. any help would be great. i have done a program than makes a double image but this need to happen slowly.

Member Avatar for marksman123
0
607
Member Avatar for SK6114

Hey, I have pylab and I want to plot a histogram of the following : Basically I generate a random integer between 0 and 1.0 about 10,000 times and then I want to arrange each integer into a separate bin of the histogram so I can see on the histogram …

Member Avatar for Gribouillis
0
115
Member Avatar for giancan

Hi guys, I'm having problems with wxPython. If I put in the header of my files from wxPython.wx import * it works fine, even if I see a DeprecationWarning about it. If I write import wx (as also wxformbuilder would do) I get errors like name wxPySimpleApp is not defined …

0
97
Member Avatar for ljvasil

Hi all, I wrote this somewhat simple script that is suppose to change and update polygon GRIDCODES based some rules. The shapefile is reclassified into likelihood of conversion. So the code is set up to get the GRIDCODE value of all adjacent polygons to the cursor polygon. I put these …

Member Avatar for Gribouillis
0
425
Member Avatar for arson09

I'm having trouble creating a function with one parameter that reads from a file and then creates and returns a dictionary based on what's in the file. And example of whats in the file: [ICODE]115 139-28-4313 1056.30 135 706-02-6945 -99.06 143 595-74-5767 4289.07 155 972-87-1379 3300.26[/ICODE] What i have: [CODE]open('balance.txt', …

Member Avatar for arson09
0
561
Member Avatar for csterling

I have a large number of files that begin with numbers (e.g., 10admin_boundary_x) and would like to rename the files so that they do not begin with a digit (e.g., admin_boundary_x). I am working with shapefiles (.shp, .shx, .dbf, etc) and thought a python script could save me some time. …

Member Avatar for TrustyTony
0
2K
Member Avatar for flynismo

Hi.. this is not a "which is better" thread, although if you happen to have a reason for thinking so, please share your thoughts. First I just want to say that I do not want to have any flame wars or arguments or anything like that. Please keep emotional arguments …

Member Avatar for rubberman
0
199
Member Avatar for JOSED10S

1)Write Python code that asks the user for two angles of a triangle. Then, first determine if the triangle can exist (make sure that the third angle can be found such that the sum of the three angles is 180°, with all angles both given and computed conforming to the …

Member Avatar for Cireyoretihw
0
1K
Member Avatar for Wilha

[CODE]import math print "Select unknown variable" print "a, b, or c" print equation=input("> ") if equation == a: b=input("Enter b: ") c=input("Enter c: ") a=math.sqrt(c ** 2 - b ** 2) print "a= ",a [/CODE] **i get the following traceback Traceback (most recent call last): File "C:\Python27\My Programs\pt.py", line 7, …

Member Avatar for TrustyTony
0
203
Member Avatar for felix001

I have a number of lists such as ['BLAH', 19, '11111', 'Fa0/19', '100000000'] I either need to make a list of lists or a dictionary containing lists. What would be the recommended one to do and will make the process of further sorting and text manipulation the easiest. Thanks,

Member Avatar for woooee
0
166
Member Avatar for ryufire
Member Avatar for adrain91

1 the computer displays some secret word(in underscore):--- 2 I guess letter"c"in the word 3 yes,the screen pops up like this :c-- 4 I guess the second letter is u 5 yes , it is :cu- 6 last ,I guess the final one is p 7 yes , it is …

Member Avatar for Cireyoretihw
0
249
Member Avatar for vlady

Hello, I am learning classes and object and I have a problem with this code. Simply does not work. Can you tell me the reason please? Error message tells me that Distance is not defined...(I don´t understand this message) Thank you for help! Vlady [CODE]class Distance(object): 'return distance between 2 …

Member Avatar for vlady
0
125
Member Avatar for Sprewell184

Hi, this is my first post. I apologize if I make any mistakes. I have a problem where I need to take a list and print it out as a table of average for each person. The list is : [('tom',4),('ben',5),('tom',8),('ben',12)] So far my code is: [CODE]def getAverage(list): list = …

Member Avatar for TrustyTony
0
127

The End.