Posts
 
Reputation
Loading chart. Please wait.
Joined
Last Seen
Ranked #3K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
86% Quality Score
Upvotes Received
11
Posts with Upvotes
8
Upvoting Members
9
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
1
4 Commented Posts
~36.6K People Reached
Favorite Forums
Favorite Tags

34 Posted Topics

Member Avatar for prakash2813

This is clearly a homework question. Maybe pay more attention in class? We would be more than willing to help you with a specific issue, but coming here and asking people to do it for you seems a bit lazy don't you think?

Member Avatar for lukerobi
-2
171
Member Avatar for A_Dubbs

Another way to do it using if statments: [code] >>> def grades(): grade = int(raw_input("Enter the student's grade: ")) if grade >= 90: return 'A' if grade >= 80: return 'B' if grade >= 70: return 'C' if grade >= 60: return 'D' return 'F' >>> grades() Enter the student's …

Member Avatar for vegaseat
0
13K
Member Avatar for lukerobi

I am currently trying to load a few script through boost python. I ran into some trouble today while trying to launch idle from it however and I cannot figure out the cause of the issue. This is on a windows 2008 machine, and I am currently running Python 3.3 …

Member Avatar for lukerobi
0
415
Member Avatar for trips.dude

Welcome to the forums! For the future, please use the code tags around your script to make it easier to read :) ([url]http://www.daniweb.com/forums/announcement114-3.html[/url]) This does look like a homework question, so please read the rules about posting homework questions here: [url]http://www.daniweb.com/forums/announcement114-2.html[/url] Here is an example for comming up with prime …

Member Avatar for samvinogar
0
17K
Member Avatar for lukerobi

[code] class MyList(list): def __new__(cls, *p, **k): if not '_the_instance' in cls.__dict__: cls._the_instance = list.__new__(cls) return cls._the_instance def append(self, name): if name not in self: list.append(self, name) def extend(self, names): for name in names: if name in self: continue list.append(self, name) def remove(self, name): if name in self: list.remove(self, name) …

Member Avatar for Gribouillis
0
104
Member Avatar for Malinka

does this give u a hint? [code] >>> pattern ('w1', '', 'w3', '', 'w5') >>> line 'w1 A w3 B w5 w6 w7 w8' >>> for index in range(len(pattern)): if pattern[index] in ['', line.split(' ')[index]]: print line.split(' ')[index] w1 A w3 B w5 >>> [/code]

Member Avatar for Malinka
0
101
Member Avatar for rackster992

I do believe that is in fact a school book. It was written to be teached in a class setting. You may be able to find a instructor's edition (with the anwsers to all the excersises, tests, ect...) If you have some scripts that are not working or questions... You …

Member Avatar for dcghelp
0
1K
Member Avatar for krishna_sicsr

Does this help? [code] >>> f = \ ''' System Configuration: blah blah blah blah blah blah System Configuration: blah blah blah blah blah blah System Memory Configuration: blah blah blah blah blah blah System Processor Configuration: blah blah blah blah blah blah System Adapter Configuration: blah blah blah blah …

Member Avatar for krishna_sicsr
0
139
Member Avatar for mms6

[QUOTE=mms6;1029045]I want to allow certain characters to a string For example I want strA to contain either 'A' or 'B' or 'C' or 'D' How do I do that, help would be greatly appreciated. Thanks strA = 'A' or 'B' or 'C' or 'D'[/QUOTE] Your questions are soooo vague. Could …

Member Avatar for mms6
0
89
Member Avatar for mms6

Whats lens()? Is that supposed to be len() ? Here is one of several possible solutions to your problem: [code] >>> def ispair(strA, strB): # Is strA too long or short? if len(strA) != 1: return False # Is strB too long or short? if len(strB) != 1: return False …

Member Avatar for vegaseat
0
132
Member Avatar for msaenz

im actually not sure why that happens, nor have i ever had a situation where i needed them to stay in order.. [code]al x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5} >>> x {'four': 4, 'three': 3, 'five': 5, 'two': 2, 'one': 1} [/code] dicts sort …

Member Avatar for vegaseat
0
169
Member Avatar for mms6

[QUOTE=mms6;1027932] I get output "ou" What happened to the rest "ouuo"? please, someone I need some assistance [/QUOTE] What was your input?

Member Avatar for Kolz
0
73
Member Avatar for thehivetyrant

why not use a set for this? [code] info = {'x1': 123, 'y1': 456, 'x2: 789, 'y2': 012} [/code]

Member Avatar for thehivetyrant
0
863
Member Avatar for vnproduktionz

[QUOTE=vnproduktionz;1027910]wow that help a bit so now i got this [code] for line in budgetLineList: if "Total Current" in line: word=line.split() good=word[3] float(''.join(good)) if "State" in line: word1=line.split() good1=word1[4] float(''.join(good1)) print float(''.join(good1))/float(''.join(good))*100 [/code] now my probelm is that when it prints it only prints the last value it doesnt go …

Member Avatar for vnproduktionz
0
167
Member Avatar for vnproduktionz

[QUOTE=vnproduktionz;1028267][CODE]reply=float(raw_input("Enter your choice: ")) if reply!=1 or reply!=2: print "Not a Valid Choice" [/CODE] i cant use while loops other wise i prob wouldve done so. Basically im trying to get the user input to only allow the numbers 1 or 2. anything else should give a not a valid …

Member Avatar for vnproduktionz
0
140
Member Avatar for pyprog

I am trying to figure out a situation which requires looping... [code] >>> string 'Take out all the 111111111111111111' >>> string.replace('1','').strip() 'Take out all the' [/code] See what i mean? If you just need a while example... [code] >>> x = 0 >>> while x < 10: x += 1 …

Member Avatar for Gribouillis
0
109
Member Avatar for python.noob

Does this give you any insight? [code] >>> class employee(object): def __init__(self): self.name = raw_input('Enter employee name: ') >>> class calc(employee): def pr(self): print self.name >>> d = calc() Enter employee name: Bob >>> d.pr() Bob [/code]

Member Avatar for AutoPython
0
220
Member Avatar for denniskhor

[code] >>> mystring = 'I have a t on my keyboard' >>> mystring.replace(' ', ' \') 'I \\have \\a \\t \\on \\my \\keyboard' [/code]

Member Avatar for lukerobi
0
80
Member Avatar for simpatar

try: [code] print('The temperature is %f degrees Fahrenheit.' % fahenheit) [/code]

Member Avatar for bumsfeld
0
272
Member Avatar for srk619

Could you reword your question a little better? maybe give an example of what your looking for, and any code your have allready tried and failed with?

Member Avatar for vegaseat
0
85
Member Avatar for lewashby

Here is a quick example of a class and some attributes: You can see A and B are unique entities, but use a common class. [code] # A class class example(object): attribute1 = 1 attribute2 = 2 def example_method(self): return 'method function' A = example() B = example() # Some …

Member Avatar for willygstyle
0
305
Member Avatar for Kruptein

You mean something like this? [code] def numtolet(num): letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] return letters[num] [/code] >>> numtolet(1) 'B' >>> numtolet(14) 'O'

Member Avatar for bumsfeld
0
205
Member Avatar for jmark13

[code] >>> L1 [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] >>> L2 [1, 2, 3, 4, 11] >>> L3 = [] >>> for x in L1: for y in L2: if y in x and x not in L3: L3.append(x) >>> L3 [[1, 2, 3], …

Member Avatar for lukerobi
0
193
Member Avatar for lukerobi

How would i do this? [code] import random name = random random.name [/code] I dont cant to use name = random.random, as name is something that could change

Member Avatar for lukerobi
0
166
Member Avatar for lrh9

Isnt this allready a method of string? [code] >>> x = 'Testing ONE TWO THREE' >>> x.swapcase() 'tESTING one two three' >>> [/code]

Member Avatar for lukerobi
0
253
Member Avatar for edificationtube

might be able to do something like.. [code] # Correct answers answers = { 'songA': {'title': 'hello', 'composer': 'bob', 'year': 1984}, 'songB': {'title': 'goodbye', 'composer': 'jan', 'year': 1983}, 'songC': {'title': 'i love pie', 'composer': 'carl', 'year': 1982} } # Holder for user's anwsers values = {} # Ask questions for …

Member Avatar for lukerobi
0
66
Member Avatar for moedoc10

does this help you? [code] >>> n = 10 >>> for i in range(1,(n + 1)): if n % i == 0: print '%i factors into %i' % (i, n) 1 factors into 10 2 factors into 10 5 factors into 10 10 factors into 10 >>> [/code]

Member Avatar for lukerobi
0
108
Member Avatar for lukerobi

Could anyone lend some help? Trying to figure out how to do this in SQLite3 (this is mySQL) [code] CREATE TABLE car_contacts ( id INTEGER NOT NULL AUTO_INCREMENT, carriers_id CHAR NOT NULL, name CHAR NULL, phone CHAR NULL, phone_ext INTEGER NULL, fax CHAR NULL, email CHAR NULL, PRIMARY KEY(id, carriers_id), …

0
87
Member Avatar for lukerobi

lets say i have 2 lists: lista = [1,2,3,5,6,7] listb = [4,5,6,7,8,9,10] The lists can be different lengths, and may not allways be unequal lengths. The higher average will allways be in listb, so that is the 1 constant we can rely on. This works for even teams: [code] average …

Member Avatar for vegaseat
0
99
Member Avatar for MichelleCrews

[QUOTE=MichelleCrews;1001890]hey, ima first time programmer and i no clue whats going on someone please help!! i have to write a function called number_of_2s that includes one parameter, N, where N is a positive integer that is no more than 10 digits long. the function should return the number of times …

Member Avatar for MichelleCrews
-1
105
Member Avatar for lukerobi

lets say i have a list: L = [1,2,3,4,5,6,7,8,9] x could be anything, but it wont ever be longer than len(L) - 1.. just for what im asking, im setting it to 3 x = 3 value could also be anything, but not exceeding sum(L) value = 8 What i …

Member Avatar for lukerobi
-1
85
Member Avatar for khaos64

you could use zip... [code] >>> users = ('bob', 'carl', 'edna') >>> passwords = ('1234', 'pass', 'icu812') >>> zip(users, passwords) [('bob', '1234'), ('carl', 'pass'), ('edna', 'icu812')] >>> mydict = dict(zip(users, passwords)) >>> mydict['bob'] '1234' >>> dict(zip(users, passwords))['bob'] '1234' [/code] or you could use indexes: [code] >>> passwords[users.index('bob')] '1234' [/code] u …

Member Avatar for khaos64
0
273
Member Avatar for CurtisEClark

Maybe this will help you see what you have done wrong: [code] >>> myvar = 0 >>> while myvar != 8: myvar = int(input("input 8 to stop the loop: ")) input 8 to stop the loop: 4 input 8 to stop the loop: 23949 input 8 to stop the loop: …

Member Avatar for vegaseat
0
242
Member Avatar for Lamb_Chops

[QUOTE=Lamb_Chops;999902]I can't for the life of me solve this problem :icon_confused: Write a function called rand_goodbye(name) that returns (not prints!) a string that says goodbye, where the goodbye phrase is chosen at random from these three possibilities: * Goodbye name * See ya' later name * name: stay cool! I'm …

Member Avatar for lukerobi
0
62