3,386 Posted Topics

Member Avatar for jecelone

Check your identifiers: http://www.developer.com/lang/other/article.php/626321/Learn-to-Program-Using-Python-Variables-and-Identifiers.htm

Member Avatar for TrustyTony
0
102
Member Avatar for inaxassan

You are still far off. Repeat the basics, read the assignment and explanation you got.

Member Avatar for TrustyTony
0
297
Member Avatar for slimergan

type("string"). type("int"). Maybe? You do not really explain what you are really doing so we can not know.

Member Avatar for rubberman
0
240
Member Avatar for Sudo Bash

I do not see much difficulty for program itself for the way you have put the variables, only thing is that you have lot of Class variables that normally are to be avoided as much as possible. Maybe you should look at putting data to a configuration file http://docs.python.org/2/library/configparser.html

Member Avatar for Sudo Bash
0
254
Member Avatar for june.pierre.311
Member Avatar for siaosituimoloaublood

return should be in place of break, I think. Also rounding to 2 decimals does not make sense after so small tolerance for error, generally you also do not round, you just format the printing.

Member Avatar for TrustyTony
0
5K
Member Avatar for shills300

Post your code if you get stuck, do not forget any error messages and explanation how you tried to solve the problem you stuck with. Also make sure that all parts are fully tested before you add code one small bit at a time, so you know that bug is …

Member Avatar for vegaseat
0
3K
Member Avatar for bobys

Why would you not describe the task you have, what have you done, your ideas how you plan to do the rest of it? For example the test cases you have prepared for your coding. Then we can give some ideas to get you going.

Member Avatar for bobys
0
331
Member Avatar for subtoneweb

*@KaeLL* > Since usually the main constraint in C++ is performance This is not true, it is compiled language and still this is not normally the case even in interpreted language like Python I am mostly using. The main constraint is overcomplicating things, hard coding, making unreadable or too long …

Member Avatar for deceptikon
0
410
Member Avatar for biscayne

You might be interested in my code snippet from two years ago: http://www.daniweb.com/software-development/python/code/293490/text-file-based-information-access-by-field-name-and-number

Member Avatar for Schol-R-LEA
0
827
Member Avatar for eternalcomplex

Nice woooee, bit nicer still if you include self.next_card = 0 in shufle_deck method and we should check when deck is dealt completely by catching index error from deck. other maybe more common method would use pop from list of cards, which makes running out of cards bit more obvious.

Member Avatar for TrustyTony
0
481
Member Avatar for stevthym

You can only index array module array by integer position, I do not see why you would choose to use it.

Member Avatar for sneekula
0
221
Member Avatar for dean.ong.14

> I would recommend using the random.shuffle() function on the series of questions; however, to do that, you'll need to make a small change, which is to make the outer tuple holding the question-answer pairs into a list. And why should he, works for me OK with tuple, but I …

Member Avatar for dean.ong.14
0
455
Member Avatar for Cosmo_Kramer

Why are you using numeric module? Remakably similar code to http://www.stealthcopter.com/blog/2010/01/python-cryptography-decoding-a-caesar-shift-frequency-analysis/

Member Avatar for Cosmo_Kramer
-1
304
Member Avatar for ashley9210
Member Avatar for Gribouillis
0
147
Member Avatar for Melly3

I would not call it absolute beginer's more like copy paster's http://mail.python.org/pipermail/tutor/2006-February/044870.html Or you are really long time beginner.

Member Avatar for TrustyTony
0
178
Member Avatar for biscayne
Member Avatar for biscayne
0
2K
Member Avatar for Bluescreendeath

If you want to do integer math only, multiply first. I do not understand what you are meaning with the formula of yours (60s cancel) You want to do fraction of day from the difference in day lengths?

Member Avatar for Gribouillis
0
240
Member Avatar for darnold4014

http://docs.python.org/2/tutorial/index.html (also in IDLE help) is quite nice tutorial. When you have gone through that, you should have fair grasp of the language.

Member Avatar for TrustyTony
0
116
Member Avatar for LSangalli

python.org tutorial is nice one to get you started http://docs.python.org/2/tutorial/index.html (also in IDLE help) height_in_meters is not `height * 2.54` but `height * 0.0254` and you need two stars to raise to power.

Member Avatar for TrustyTony
0
334
Member Avatar for anonymous0318

Yes join does fine, here I have mocked the run finding to isolate this function from your implementations of runs. It does not make sense to save actually any other info than the first value in data it is alternating between 1 and 0. Also I am wondering wjat happends …

Member Avatar for woooee
0
224
Member Avatar for premminister
Member Avatar for jarg12

I still think it is good idea to just send them download link for Python3 installer and your code to them. They just run installer and open your code. If you put it with .pyw extension they do not get the console window for GUI stuff, for console stuff use …

Member Avatar for pauljwells
0
171
Member Avatar for krystosan

There seems to be a module you can install for that http://www.hardcoded.net/articles/send-files-to-trash-on-all-platforms.htm

Member Avatar for krystosan
0
124
Member Avatar for krystosan
Member Avatar for TrustyTony
0
99
Member Avatar for GoodPie

Copy pasting same if statement 4 times is not proper effort, you should test your code and ask only about the last addition.

Member Avatar for GoodPie
0
217
Member Avatar for ArtemKrass
Member Avatar for pashah

Here for debugging few test cases to get you started: >>> b = Box(1,2,3) >>> b.volume 6 >>> b.area 22 >>> b = Box(5,2,3) >>> b.area 62 >>> b.volume 30 >>>

Member Avatar for pashah
0
176
Member Avatar for lewashby
Re: wx

What do you mean do not work? What is the error message, what versions of wx you have installed in Python 2.7 and what in Python 3. Are you sure you switch between the versions properly (wxversion.select)?

Member Avatar for Lardmeister
0
136
Member Avatar for hotblink
Member Avatar for fantasma.delespacio.773

Related article is my code on subject which got me price in summer code snippet competition, you can compare with that.

Member Avatar for hughesadam_87
0
168
Member Avatar for Triarius_1

Hint how many lines you can find that has exactly 4 commas and end up having 5 values in list?

Member Avatar for vesuvius
0
391
Member Avatar for nUmbdA
Member Avatar for nUmbdA
0
210
Member Avatar for hotblink
Member Avatar for krystosan

# add jpg, tif or png and the folders to the newLst newLst += [file for file in thisdir if os.path.isdir(file) or file.endswith(('.jpg', '.tif', '.png'))]

Member Avatar for TrustyTony
0
178
Member Avatar for shayallenhill

Could you give short example with one type and some values to show what you are really doing, I do not understand. (So otherwise I would say you are completely wrong, but I am not really OO expert)

Member Avatar for shayallenhill
0
131
Member Avatar for raghuvbhat
Member Avatar for woooee
0
63
Member Avatar for raghuvbhat

I see no SQL in your code and the functions are never called. I would write: def writelogfile(a, strg): logging.debug(strg + (' function completed', ' function started')[a])

Member Avatar for TrustyTony
0
137
Member Avatar for TrustyTony

Now that MITx first test is over, I got feeling that this one task requested for generate and test solution is begging also for less efficient recursive solution as it is so simple. Here it is! Single liner aproved by the released grader! If you wander if you are able …

0
314
Member Avatar for apayn
Member Avatar for M.S.
0
299
Member Avatar for TeaAnyOne

sorry woooee: set drops multiple vowels, doesn't it? >>> test_sentence="The quick brown fox" >>> vowels = set('aeiou') >>> vowels_counts = Counter(c for c in test_sentence if c in vowels) >>> print max(vowels_counts.items(), key = lambda x: x[1]) ('o', 2)

Member Avatar for vegaseat
0
170
Member Avatar for dylan.lange.16

No your program does not make sense for me, why would you do def resetPassword(): global password password = '' resetPassword() Instead of password = '' And you are using global everywhere and do not pass parameters in and return values out of funcitions.

Member Avatar for woooee
0
117
Member Avatar for nag18

My 2 c: Your rooms should be instances of Room class. You are messing around and everything is mixed up. Use dictionary of Room and make \__hash__ for Room so room instances can be used as keys of dictionary.

Member Avatar for TrustyTony
0
96
Member Avatar for ThePythonNoob

For me it is confusing to call funciton printbye, when it only sets one instance variable. I would try something like this, which delegates the messages to message attribute class MessageObject(object): def __init__(self, message): self.message = message self.__name__ = 'MessageObject' def __str__(self): return str(self.message) def __repr__(self): return '%s(%r)' % (self.__name__, …

Member Avatar for TrustyTony
0
2K
Member Avatar for Melly3

I think you should also call your main function ;) Luckyly the sum can not be the 6-tuple of numbers as the sum or point variables do not change inside the while at line 14. sum is also bad name for variable as it is used for function to do …

Member Avatar for snippsat
0
3K
Member Avatar for alexandra.hoops.3
Member Avatar for ggauravag2012

This test question for MITx course should not be discussed before ending of the test period Nov 4. I can just say that you should do the first problem of debugging the fixedPoint before trying to use it in following parts.

Member Avatar for TrustyTony
0
836
Member Avatar for shanenin
Member Avatar for sick vapor

#Membership rules ##Keep It Organized * Do provide evidence of having done some work yourself if posting questions from school or work assignments

Member Avatar for sick vapor
0
2K
Member Avatar for Delightfully

To do it recursively as you code, I would use recursive generator with for: >>> def exponents(num1,num2): if (num2==0): yield 1 else: for r in exponents(num1,num2-1): yield r yield num1 * r >>> list(exponents(2,3)) [1, 2, 4, 8] In iterative version you could yield each subresult, or append to list …

Member Avatar for TrustyTony
0
2K

The End.