Click here to Skip to main content
15,914,500 members
Everything / Programming Languages / Python 2.4

Python 2.4

Python2.4

Great Reads

by yousafzai amazai
In this article we see how selection sort can be implemented with swapping pointers.
by James Dale
My Windows Sever 2003 reaches its end of life in 2015. I do not look forward to moving to Server 2012. Surely there has to be a better, portable, and cross platform solution that features zero install and fits on a USB stick.

Latest Articles

by yousafzai amazai
In this article we see how selection sort can be implemented with swapping pointers.
by James Dale
My Windows Sever 2003 reaches its end of life in 2015. I do not look forward to moving to Server 2012. Surely there has to be a better, portable, and cross platform solution that features zero install and fits on a USB stick.

All Articles

Sort by Score

Python 2.4 

27 Dec 2011 by Sergey Alexandrovich Kryukov
The best source of Python manuals is this:http://www.python.org/[^],start from here: http://docs.python.org/py3k/tutorial/index.html[^].One of the best way of using Python in Web development is WSGI....
15 Mar 2021 by Richard MacCutchan
The Python Tutorial — Python 3.7.10 documentation[^]
22 Dec 2014 by yousafzai amazai
In this article we see how selection sort can be implemented with swapping pointers.
19 Jun 2020 by Richard MacCutchan
This is the same issue as your previous question at Why the multilevel inheritance doest work ?[^]. You must pass the correct number of parameters to the super class, as clearly stated in the error message. If you do not understand how classes...
19 Jul 2022 by OriginalGriff
If you need to use the same numbers - and you do - then generate the randoms numbers and store them in an array: Python Arrays[^] You them modify both the mean and standard deviation code to use the data from the array instead of fetching a new...
22 Jul 2022 by Patrice T
Quote: apparently the program works well, but I needed to consider the value 0 also in the for result Try this: for i in range(0,np+1): print("%.1f" % a) a+=(l/np)
24 Jul 2022 by Richard MacCutchan
list = [3,0,1,-2] for i in range(1, len(list)): list[i] += list[i - 1] print(list) Produces: python atest.py [3, 3, 4, 2] Python test result: 0
11 Oct 2023 by Richard MacCutchan
setpos(0, length ) Should be terry.setpos(0, length ) I just noticed that your instantiation is also incorrect at line 3, it should be terry = turtle.Turtle() # note the parenthesis
31 Jul 2014 by OriginalGriff
We will accept articles (or blog posts) on almost any computing related technical subject, so Python isn't a problem: there are even existing tags for Python and a number of articles about it.Would your article be accepted? Depends. It would have to be good, original, and useful - which...
9 Nov 2014 by Suraj Sahoo | Coding Passion
Check this tutorial point[^]SQLLITE[^]You have not mentioned what you are using for Data access, I have given two links, one using MySql and other using SqlLite.Hope these help.Thanks.:)
15 Nov 2014 by OriginalGriff
No.We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may...
17 May 2015 by Sergey Alexandrovich Kryukov
Here: https://www.djangopackages.com/grids/g/charts[^].—SA
16 Jul 2015 by 123420
Try int; { { { label.access = accessLimit.Int;intVal{useExcrimintories:viewPort_1} acrossVal.usbPortviewPort() ; internalUseP[internalAdd{[label.y==MessageIgnore],onOperation(display=)]} random(); accessPort=true binary ;;portReadOnly=true...
27 Jan 2018 by Thomas Daniels
Both newjoke and the code in the while loop will ask "Did you find that funny?". So, what you see is the question getting repeated because after newjoke get called, you'll go back to the beginning of the while loop. This gives the impression of displaying a blank joke, but you just didn't hit...
27 Jan 2018 by Thomas Daniels
print("\nWell what about this:\n\n",joke) print("a", "b") will print a b with a space in-between. That's what's happening here too: it prints the "What about this" with the newlines, then a space, then the joke. Try this instead: print("\nWell what about this:\n\n" + joke)
29 Jan 2018 by OriginalGriff
Try returning the value: def even_number(): list = [] for n in range(0, 6): if n % 2 == 0: list.append(n) return list print(even_number())
18 Mar 2018 by Richard MacCutchan
Your formatting leaves much to be desired. However, you can simplify things by checking the values as you go through the initial loop, like this: flavours = ["Vanilla", "Chocolate", "Mint Choc Chip", "Rosewater", "Strawberry", "Mango", "Frutti Tutti", "Fudge Brownie", "Bubblegum",...
19 Jun 2020 by markkuk
I think you don't really understand what "inheritance" in object-oriented programming means (it's not a way to describe family trees). Inheritance describes an "is-a" relationship between the subclass and parent class. In your code the class...
19 Jul 2022 by CPallini
Note: your computation of the average is NOT correct: for i in range(0, 6): soma += sorteio() extracts (and sums up) 6 values, while media = soma / 5 divides by 5. Anyway, as already suggested by Griff, consider rearranging your code for...
26 Jul 2022 by OriginalGriff
Use the zip function[^]: final_list = [sum(value) for value in zip(lst, lst1)]
26 Sep 2022 by CPallini
Quote: img = cv2.cvColor(img, cv2.COLOR_BGR2RGB) Mistyping error ('t' missing): The method name is cvtColor, see Python OpenCV | cv2.cvtColor() method - GeeksforGeeks[^].
16 Feb 2023 by Richard MacCutchan
You get date and time information via datetime — Basic date and time types — Python 3.11.2 documentation[^].
22 Dec 2009 by Leonidye
How to convert two strings of C type #define ABCD 0x0FA#define EFGH "1234 beef" into two strings of C# typepublic static uint ABCD = 0x0FA;const string EFGH = "1234 beef";using Python or any other [scripting] language?Particularly, I would like to convert C/C++ .h or .c...
22 Dec 2009 by Christian Graus
Perhaps you need to explain what you mean. Do you mean take a C++ source file and turn it into a C# source file ? In that case, I'd imagine that you'd use regular expressions to generate the new file from the old one.
31 Jan 2011 by jim lahey
It's a complete guess as I don't really know Python, but if you're getting an authentication error that means the underlying connection is actually working, you're just supplying the wrong credentials to the webservice.I would try the username in combination with the domain like...
22 Nov 2011 by Pete O'Hanlon
At the end of the setvibration line, you don't have a semi colon. You need to add one so that it looks like the following:if (yourmum = buttonState.pressed) setvibration(playerindex.me,1,69); // This line needs the semi colon,.else { redIntensity++; }Next, you terminate the...
27 Dec 2011 by #realJSOP
17 MILLION google results for the search phrase "learn Python"[^]...and the first two results returned are beginner articles. Goggle reveals all.
10 Jan 2012 by Soniya65
I want to make some changes in blender source code. I want to import one COLLADA file continue sly like loop in blender. is any Idea?
8 Feb 2012 by Member 7985084
Hi All, I am looking for Python Interpreter to be compatible with my WPF Application, I need to support Python Scripts and execute the same, I have the working implementation of CINT (C/C++ Scripts), Please find details below, 1. The Python Interpreter module(wrapper)...
12 Feb 2012 by pramod037
hi, As part of my project, i need to measure the USB enumeration time in OS and display to the user. I'm not sure whether that's already implemented in Windows 7. So, if it's not implemented, can i use Python to get the same, or which is the good language to get those values? Please...
12 Feb 2012 by RDBurmon
Hope this helpshttp://www.teamwavelength.com/permanent/usb/docs/api/src/cs-win-001.html[^]Accept and vote this if helps--Rahul D.
13 Feb 2012 by Jochen Arndt
As far as I know, Windows does not measure the time itself. There is no reason to do so.If there is any solution to measure the time, C++ would be the best choice. Because you need to add some kind of low-level handler that is triggered by the plugin event. When an USB device is plugged in,...
15 Nov 2012 by Madzmar25
Hello guys.. I was wondering if any of you tried using DATE_FORMAT in python? you see I'm trying to format one of my field using date_format but the problem is when I try to run it in python it gives an error since % symbol is reserved char for python here is my python codedef...
5 Dec 2012 by Madzmar25
Never mind guys I already solved it... Just for the record here's what I came up withdef get_announcement(con): try: c = con.cursor(DictCursor) query = """ SELECT id, page_id, title, ...
13 Aug 2013 by Member 10206913
import urllibimport urllib2import cookielibprint "Expolit and Damage ... Project Bee"url = "http://www.torn.com/authenticate.php"username = raw_input("Your name: ")password = raw_input("Your password: ")query = {'username': username, 'password': password}data_query =...
13 Aug 2013 by Member 10208126
or example: consider the contents of file1.txt: 1 0 9227 1152 34 2 2 111 7622 1120 34 2 3 68486 710 1024 14 2 6 265065 3389 800 22 2 7 393152 48438 64 132 3 8 412251 46744 64 132 3 9 430593 50866 256 95 4 10 430730 ...
10 Dec 2013 by PythonProgrammer
I have a program that has a text file and what I am trying to do is grab the data and print it. However, when I look at my batting avergae, it is only grabbing the first average not the highest batting averageef getLists(): # Create a Variable to ask the user to get the file fname...
10 Dec 2013 by YvesDaoust
You are confusing the value and the index. Useif highestAverage >= averages[i]: highestIndex= i highestAverage= averages[i]print(players[highestIndex], averages[highestIndex])
4 Feb 2014 by johnbekkam
Hi All, I'm john rightover here i'm able to get the messages of the message of rabbitmq when interactin with openstack components nova but i don't know how to filter those messages using pika module in python.I'm very Thankful for any help looking for quick response.Regards,John
23 Jun 2014 by manishakc
I have a C# windows application, where i need to pass object created in python script - as argument to C# program and vice-verse. So how do i pass object created by Python script to C# program as parameter.For this, i don't want to use Iron-Python. My strict requirement is to use object...
11 Aug 2014 by Member 10872167
Previously i used to decrypt my whtsapp chat of msgstore.crypt file by using python ,but now whtsapp update provided msgstore.crypt7 file which is not getting decrpted by using python. Please tell me how i will read whtsapp chat of msgstore.crypt7 file using python
22 Oct 2014 by Member 10390715
Hello I write code read RFID tag using python,check the existence of the ID in the database.It successfully, right ID on database led is ON, but command insert to database not work. Python no error message, and I do not understand what's wrong with it.How can I fix it? Please help me. Thank...
4 Nov 2014 by Member 10390715
I make project read RFID tag using python on raspberry pi and using reader RDM880.My idea is to take the time in and time out to check with the staff to work on time or not.I try to add card_ID, time_in, time_out to local mysql and remote mysql (IP: 192.168.137.1) using python.I have the...
8 Nov 2014 by Member 10390715
I have a table "control" like this in local mysql (IP = 192.168.137.165)Card_ID Time_in Time_out Index 101 7:00 11:00 0 102 7:15 11:00 1 103 6:45 12:00 1Local and remote tables "control" are the same...
9 Nov 2014 by Member 10390715
I have a table like this: ID Candy - fruit Index 101 banana 1 102 chocolate 0 103 orange 1 104 apple 1 105 cake 0I want to select all rows have...
9 Nov 2014 by MJ2014
use standard sql query.But only execution type will be different as shown#!/usr/bin/pythonimport MySQLdb# Open database connectiondb = MySQLdb.connect("localhost","testuser","test123","TESTDB" )# prepare a cursor object using cursor() methodcursor = db.cursor()#...
19 Nov 2014 by Sergey Alexandrovich Kryukov
Your problem is not isolating pure time from datetime. Your problem is treating time as string. You cannot compare objects of incompatible types. Comparison time with a string, even it is supposed to represent time, in your opinion, means no more that comparing time with the phrase "I am a...
1 Dec 2014 by Sergey Alexandrovich Kryukov
The exception "string index out of range" doesn't worth "getting to output", whatever it is. You need to prevent this exception instead. Not doing so would be a serious abuse, even if you make it working. You can run it under the debugger and see there the exception is thrown. Let me tell you...
2 Dec 2014 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
2 Dec 2014 by Sergey Alexandrovich Kryukov
Sorry, this is not a question. Remember, this is a Quick Questions & Answers forum.—SA
20 Jul 2015 by Member 11849526
I'm trying to write a python script which reads data from one csv file and based on that data it picks up the data from another csv file and writes it in third csv. However, the csv.reader() doesn't seem to work. It always returns
19 Sep 2015 by Member 11996436
here is what I wantedI wanted to fill the login form then the form in the page after I logged in And I wanted to do it in Python with a module called MechanizeAny idea?
3 Nov 2015 by PythonHeadBanger
Hi, I'm so sorry, what specifically are you looking to do? Your instructions are a bit unclear.Here is some python 3.4 code that I use to pull data from websites. It basically pulls data from a site and then saves it as a txt file. I have changed the code to something for .csv It will be...
6 Dec 2015 by Richard MacCutchan
Use a loop or a list comprehension[^].
21 Mar 2016 by Dave Kreskowiak
Python won't do this for you. You have to print each value, one at a time, yourself. Each time you print a value you increment a counter. When that counter reaches 4, go to the next line and reset the counter.
22 Mar 2016 by Richard MacCutchan
for x in range(1,13,4): for y in range(x, x+4): print(y, end=", ") print("")[edit]A slightly neater version:for x in range(1,13,4): for y in range(x, x+3): print(y, end=", ") print(y+1)[/edit]
27 Aug 2016 by Member 12706425
i had stored result in dictionary asplayerStats={'Murray':[2,2,16,143,13,142],'Djokovic':[3,1,13,142,‌​16,143],'Muguruza':[‌​0,0,1,12,2,15],'Will‌​iams':[0,1,2,15,1,12‌​]}Now i want to print output in decreasing order of ranking, where the ranking is according to the criteria 1-6 in that...
16 Sep 2017 by Member 13413688
hey how can we print the 2nd half part of string before 1st part like if a string is of 2n lines then write last n lines followed by first n lines. eg: INPUT: my name, saurabh singh OUTPUT: saurabh singh my name, What I have tried: i = 1 while 1: line = input() if line=='':
16 Sep 2017 by OriginalGriff
Se my answer to your previous (identical) question: How do I write code for it[^] - the answer has not changed. We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can...
16 Sep 2017 by Patrice T
We do not do your HomeWork. HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them. Any failure of you will...
9 Nov 2017 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Read the question carefully, and...
9 Nov 2017 by Patrice T
We do not do your HomeWork. HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them. Any failure of you will...
9 Nov 2017 by Member 13503527
for instance:(["one", 4, "three", 7]) would come out like:[1,4,3,7] What I have tried: def digits(lst): digits=['two','seven','three','five'] for c in '2735': s = s.replace(c, digits(int(s))) return s
27 Jan 2018 by tgspython
I'm using Python3 and I'm writing this code where it tells you a joke and asks the user if they like it. If yes, then it will print something then the program is finished. If no it will keep on telling new jokes randomly until the user says 'yes'. However, the program does run wihtout any...
27 Jan 2018 by tgspython
When I run my code there is a sort of indent at "Q:" but not "A:". Do you know why that is? It does not stop the code from running, it works, but it would look neater to me if they "Q:" and "A:" were both in line. Thanks. CODE: jokes = ["Q: What do you call a boomerang that won't come...
30 Jan 2018 by Member 13651500
Here is my code: def even_number(): list = [] for n in range(0, 6): if n % 2 == 0: list.append(n) print(even_number()) Right now, it just returns 'None'.But I would like to return the list of even number between 1 and 6. What I have tried: I have tried changing...
18 Mar 2018 by pythontimes
Hello, I hope this question makes sense because I'm not too sure how to ask it. But my program - in python - asks the user to input their score from 1-10 on these ice cream flavours in an array. Displays their score and then prints their highest score as their favourite flavour. Which takes...
9 May 2020 by jaredtewodros
To combat a personal convenience issue and learn more about APIs, I made a python program that prompts a user for a YouTube playlist and transfers the songs from that playlist into a new or existing Spotify playlist (destination also prompted). I...
9 May 2020 by Richard MacCutchan
It is impossible to give a comprehensive answer to such a question in a Quick Answers forum. You need to do some research into the various web interfaces and frameworks that are available, all of which provide lots of materials to help you decide...
19 Jun 2020 by Ahmad Qassym
class Grandfather: last = 'wilson' citizenship = 'american' residence = 'Detroit' def __init__(self,first,college,age,career,workplace): self.first = first self.college = college self.age = age ...
11 Jul 2020 by Ahmad Qassym
## the first example class quadriLateral: def __init__(self, a, b, c, d): self.side1=a self.side2=b self.side3=c self.side4=d def perimeter(self): p=self.side1 + self.side2 + self.side3 +...
11 Jul 2020 by OriginalGriff
You can ... ish. You can't actually remove parent properties of methods, but it is possible to "hide" them: Hiding Inherited Properties and Tasks in Derived Classes[^]
11 Jul 2020 by Richard MacCutchan
I do not think that is possible in Python, see 9. Classes — Python 3.7.8 documentation[^]. And why would you want to?
16 Jul 2020 by Maciej Los
As Patrice T mentioned you have to read the documentation[^]. I'd suggest to read these: Python - Numeric Type Special Methods[^] python - Under what circumstances are __rmul__ called? - Stack Overflow[^]
30 Jul 2020 by OriginalGriff
Step 1: Learn Python. Step 2: Learn VB Step 3: Use the Python code as a specification for a new VB app. Never convert languages, it doesn't produce good code in the target language because it uses a totally different framework, and the data...
8 Nov 2020 by Richard MacCutchan
Quote: Currently in a rush to get the solution. Slow down and think about what you need to do. Rushing into code before you have planned the logic is likely to lead to a greater number of mistakes.
8 Nov 2020 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
16 Mar 2021 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
17 Sep 2021 by OriginalGriff
Repost: Deleted. Please do not repost your question; use the Improve question widget to add information or reformat it, but posting it repeatedly just duplicates work, wastes time, and annoys people. I'll delete this one.
22 Apr 2022 by Member 15610277
Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete What I have tried: Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete
21 Apr 2022 by OriginalGriff
See here: Python Functions (w3Schools)[^]
21 Apr 2022 by Richard MacCutchan
You just need all the search code in your listSearch function. You then call it with the user's input value: def listSearch(userword: str): for D in Dates: if D == userword: print(facts[Dates.index(D)]) for K in Keywords: if K ==...
22 Jul 2022 by Patrice T
Quote: Not sure where to start with this question, anyone got an answer? Start by solving the problem by hand, how you solve is basically your algorithm. If problems, show your work and explain how it go wrong, we help fixing your code.
22 Jul 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
24 Jul 2022 by Rodrigo 2022
hello guys, my question is how to relate these two lists, for example: if the DISTANCE of force 1 is 3 and this is in index 4 of the first list, the FORCE of force 1 should be found in index 4 of the second list What I have tried: from math...
24 Jul 2022 by Rodrigo 2022
how to do a sum in the list, for example [3,0,1,-2,] return [3,3,4,2], adding index by index What I have tried: list = [3,0,1,-2] total = 0 for i in list: total = total + i print(lista)
31 Jul 2022 by Richard MacCutchan
You need to create a new sub-list inside list2 for each iteration of car, something like: u=0 car=3 list2 = [] for j in range(car): list2.append([]) # add a new sublist to list2 for i in range(3,10): u += (5 / 10) * -3 list2[j].append(u)...
25 Nov 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
2 Dec 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
1 Oct 2014 by James Dale
My Windows Sever 2003 reaches its end of life in 2015. I do not look forward to moving to Server 2012. Surely there has to be a better, portable, and cross platform solution that features zero install and fits on a USB stick.
24 Jul 2022 by Patrice T
list = [3,0,1,-2] total = 0 # you may need to create lista here for i in list: total = total + i # add total to lista here print(lista)
9 Nov 2017 by Kenneth Haugland
Some searching should do the trick: Converting Text Numbers to Numeric Values[^] Its in C#, but should be easy to understand.
7 Feb 2012 by Sergey Alexandrovich Kryukov
With a console Python application, it is possible to start it as a child process using System.Diagnostics.Process.Start and redirect output streams StandardOutput and StandardError, please see the code sample with redirection here:...
26 Jul 2022 by Rodrigo 2022
how to make the result of this be [2,5,10,5.5] What I have tried: lst = [1,2,3,4] lst1 = [1,3,7,1.5] lsw=0 lsw=lst+lst1 print(lsw)
31 Jul 2022 by Rodrigo 2022
my question is how to create a loop for x lists, informing how many lists you would like, example 3, and in print it gives the result list 1=[0, -1.5, -3.0, -4.5, -6.0, - 7.5 , -9, 0, -10.5] list 2=[0, -1.5, -3.0, -4.5, -6.0, -7.5, -9.0, -10.5]...
18 Mar 2021 by Member 15021280
JUst trying to delete my question might as well edit it because I dont know how to delete. How to delete a question? JUst trying to delete my question might as well edit it because I dont know how to delete. How...
10 Dec 2010 by Oluwaseyi Bamigbade
import sys, math, refrom operator import itemgetterimport math#reading from test filewF = open (r'C:\Craig\Data2\craiglist-file1.txt')wordFile = wF.read()wordList = wordFile.upper()wordList = wordFile.split()#Reading from the keyword filekWF =...
22 Nov 2011 by :)9/11
if (yourmum = buttonState.pressed) setvibration(playerindex.me,1,69)else { fatness++; }if (fatCountingUp > 300kg); (setBiggestLoserShow = true);else { (setBiggestLoserShow = MEGAtrue); }if (codDisc = broken); (YouDumpGirlfriend);else { ...
25 Jan 2011 by rahil karedia
"""Enumerate...