3,386 Posted Topics
Re: How would we know, it is your code, we know nothing. MenuPage is not defined, like it says. | |
Re: > while len(runway1) > 0 and len(runway2) > 0 and len(runway3) > 0 This should be `or` not `and` > run1Plane = top(runway1) > topPassenger1 = run1Plane.getNumOfPassengers() This would need to go inside a if runway1: Then you would keep looking which of stacks has the value to pop, but … | |
Re: Are you checking for straights 1 2 3 4 5 and 10 J Q K A How your code separates hands with same highest card but different second highest? Please use **Code** from editor, do not link to code out of the site. I have lost my Python code for … | |
Re: There are many Python tutorials around, just Google. Also the vegaseats sticky message threads and the code snippets archive can be helpful. | |
Re: m and n are undefined, the loop until len(n) as n[len(n)] does not exist. Also limit of len(n) on second loop does not make sense, as n is not used in loop. Also len(a) is not len(n), but len(m)+1. | |
Re: 1. Find out base case 2. Find out how you can solve case n with cases upto-not-including n 3. Write the code 4. Debug 5. Deploy 6. Train users 6. Maintain | |
Re: What is your problem and what you are trying to do? I do not undetstand reference to read(50) as it has nothing to do with your code which reads lines. Line 3 does nothing. Your example input is only one line, so not very good test input for the loop. | |
![]() | Re: You just indent code inside another while loop. However using functions and good descriptive names according to PEP8 guidelines is good to have in your toolbox before tackling big projects. It is good to form correct habits from begining. ![]() |
Re: First points noticed: This post has not line numbers correct: http://www.daniweb.com/software-development/python/threads/418422/python-3.2.2-question/1#post17841 in it's code. The single 5 in margin looks stupid in margin for short code examples just over five lines, this is surely going to cause slew of newbies typing the line number in the code. The Featured Poster … | |
As I looked through the rules I did not find direct reference of not bumping messages, like this http://www.daniweb.com/software-development/python/threads/420770/pygame-quick-help#post1796253 I can of course down vote, as it does not require breaking the rules, but would be nice to get few comments about the unwritten law ##Thou shalt not bump your … | |
Re: You got zillion of input functions without prompts in your first code, it couldn't possibly be debugged enough to add more features. You must allways be sure that the old code is as bug free as possibly can, before adding things or you end up in mess (and looks like … | |
Re: you have many undefined and unused/unnecessary variables. Especially clumsy are first lines. Also the variable names are cryptic. | |
Re: @wooeee: you are doing selection sort not bubble sort. On the other hand bubble sort is so inefficient, that you should use insertion or selection sort. ______ For bubble sort it is customary to set flag for if swaps were made and stop sort when no swaps were done in … | |
Re: That is not Python, it is C++. Before transferring to C++ forume, why do you have pyQT in title? | |
Re: For me looks like your stack exposes the implementation detail of stacks array index, which does not make any kind of sense. I would suggest to check first of all to check your logic, can you show proof that your c++ version works? | |
Re: Also looks like your code fails to calculate 0/3 Additionally you are defining div wrong with float and calling with int. @nullptr: it should be **==** in continuation condition, not or, as at least I can not find way to make `cont` to equal both 'y' and 'Y' at the … | |
Re: Sounds heavenly, just hit TAB and then paste code and everything goes OK without being a painter (as long as syntax check identifies those unclosed vb quoted line end remarks and does OK format for them.) | |
Re: @ Lerner: And you must have thought out some examples planned before at hand to test the addition, so it basically means: **Better do Test Driven Development** | |
Re: No idea, you have not given any info of your code or problem. | |
Re: For psycology/marketing motivated choices I suggest to accept Dani's solutions. For me what matters most is only that if you hit *Code* and after paste my code it works in 1. VB forum with 'Comment here (does not matter for me personally, but seems really biggest problem of the system … | |
Re: Are you sure you are not going against [MEMBER RULES](http://www.daniweb.com/community/rules) ? | |
Re: Looks like you you are having unterminating while if you do not change the value of a in other loops. For me the a variable looks without purpose, why not just break out of while, no need for sentinel variable, it only confuses the issue. | |
Re: I do not catch exactly what you want to do as line 7 does nothing and so the loop is without purpose. import urllib2 as u zipc = "47408" url = "http://watchdog.net/us/?zip=" conn = u.urlopen(url+zipc) for line in conn: if 'Represented by' in line: print(line) | |
Re: The information on new tagging scheme have not reached even members who have posts under belt allready. http://www.daniweb.com/software-development/cpp/threads/420810/y-linked-list#post1795231 | |
Re: You can not have overloading definitions in C. | |
Re: Find which of these [membership rules](http://www.daniweb.com/community/rules) you are breaking, and fix it! | |
Re: Last rows has mixed case and you do not set the re.I flag to ignore case. | |
Re: I see that it returns 1, at line 2. | |
Re: Use the edit post link do not post again. And please indent all your code one level by highlight and pushing TAB key to make it formatted as **Code** or put ~~~ vb ~~~ around the code (line before and line after), ~ must be the first character on line. … | |
Re: You have also problem in your formatting and/or indenting. Did you read the [Formatting Help](http://www.daniweb.com/community/syntax) ? | |
Re: You could [compile from source code](http://www.wxpython.org/BUILD-2.8.html) with same C compiler as was used for your Python version. Why not just upgrade to Python 2.7.2? Or you are using embedded Python inside an application? | |
Re: No, we can not, see [Member rules](http://www.daniweb.com/community/rules) **Do provide evidence of having done some work yourself if posting questions from school or work assignments** | |
Re: You have messed up your indention! | |
New Daniweb way to copy the code from posts with indentation is to double click (not too quickly) to select the code region and use normal copy paste as you like (second mouse button or ctrl-c). Easier than before but little not obvious! | |
Re: Notice though that mark of selection is not colored background, but only lines around message turns yellow. Lines are very thin and the change is almost invisible. | |
Re: Why you are using random module but reimplement the random.sample? ~~~ >>> import random >>> import string >>> print random.sample(string.digits, 5) ['6', '2', '5', '1', '8'] ~~~ Also the commenting is very superfluous. | |
Re: Use code blocks (select code and hit TAB key), see Formatting Help in corner of reply box. | |
The vanity pages to look how good and active you are compared to others is back from member's #Community Contributions part underlined links. Thank you Dani, now we know again how good we are! *P.S. How many activity points worth is giving a spammer infraction? ;)* | |
Re: You never call the functions and you have many other problems like undefined variables and incorrect conditions. | |
Re: What the IDLE shell window says in beginning? CYGWIN & gcc? | |
Re: use the ~~~ vb style fencing code blocks for vb with quote comments, see Formatting Help. I fixed the original post for you. | |
Re: Reading is helpful skill, start from here for example http://www.linfo.org/wildcard.html | |
Re: Please for vb code use ~~~ vb .... ~~~ fenced code tags if you use quote comments, otherwise you can select the code block and hit TAB. | |
Re: And here with itertools 'magic', as here seems to be time for present solutions: from itertools import groupby # space separated data raw_data = '''DB01967 ZIPA DB01967 PFAZ DB01992 YVBK DB01992 ZAP70 DB02191 ZIPA DB02319 YQHD DB02552 ZFPP'''.splitlines() data_groups = groupby(raw_data, key = lambda x: x.split()[0]) for group, items in … | |
Re: a[0], the first value, but you get trouble with first empty list. It is more flexible to use list comprehension instead of map. |
The End.