Click here to Skip to main content
15,891,766 members
Everything / Programming Languages / Python 2.3

Python 2.3

Python2.3

Great Reads

by rerhart585
Using SQLite, leverage the create_aggregate(), and SQL's Between Operator to create a Normal Probability Distribution Histogram, or what is more commonly referred to as a Bell Curve.

Latest Articles

by rerhart585
Using SQLite, leverage the create_aggregate(), and SQL's Between Operator to create a Normal Probability Distribution Histogram, or what is more commonly referred to as a Bell Curve.

All Articles

Sort by Score

Python 2.3 

8 Dec 2016 by rerhart585
Using SQLite, leverage the create_aggregate(), and SQL's Between Operator to create a Normal Probability Distribution Histogram, or what is more commonly referred to as a Bell Curve.
7 Jul 2020 by Richard MacCutchan
You declare your Circle constructor as def __init__(self,angle:float=180,**kwargs): but then try to pass values instead of keyword pairs. You need to call it by: Circle(5,x=11,y=22) And the same with your Rectangle. Although with so few...
15 Mar 2021 by Richard MacCutchan
The Python Tutorial — Python 3.7.10 documentation[^]
23 Mar 2011 by Sergey Alexandrovich Kryukov
There is no such thing as "notepad file".Python file read/write is so simple (even for an absolute beginner) that I have no idea what answer you may need, except perhaps writing the code for you.No, this is not how CodeProject works. Please read the code and ask a question if you face any...
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
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)
9 Jul 2020 by Richard MacCutchan
Of course it does, as you are passing parameters by position and not by name. So if you reverse the order in line 12 then they will be reversed when they are received by c1's constructor. If you want the values to be referred to by name then your...
16 Sep 2020 by OriginalGriff
Why do you think? What would change if you didn't? Do two things: 1) Read this: Binary search algorithm - Wikipedia[^] And 2) Break out the debugger and follow your code through as is. Now change "m + 1" to "m" and try it again. What changed?...
16 Sep 2020 by Richard MacCutchan
The same answer as you were given four days ago at https://www.codeproject.com/Questions/5279256/Why-do-we-add-1-to-the-r-plus-m-in-the-last-line[^]. Did you follow the suggestions?
16 Sep 2020 by Patrice T
Same question as Why do we add 1 to the r + m in the last line ?[^] with mostly same code. m+1 is not alone it foes with other variables: elif lst [ m] > key : return bsearch2 ( lst , key , lo , m ) else : # lst[m]
12 Dec 2021 by OriginalGriff
Read the error message, it is pretty clear: File "C:/Users/user/Desktop/car dealer/car dealer.py", line 505, in Add_car self.insert_photo = self.convert_image_into_binary(photo) NameError: name 'photo' is not defined So it's line 505, in...
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 Mar 2011 by Ajain A K
Hai I am beginner in python programmingI want to read and write a notepad file usinga class and method in python.Can anyone help me to do so ?Any help will be appreciated.I have pasted the notepad file content to be processed belowsince I don't find any attachment option,...
29 May 2011 by ashwini hajgude
I am new to pyhton.Plz guide me for how to link python dynamically to c++.
29 May 2011 by santosh dhanawade
Lets try google for this.Even then i have little bit more information to you,Python can link with java , c++,c etc language by using various tools of python linking.As you want link with python with C++you can usedSWIGboost.pythonPyrexetc.For more info please read this link...
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, ...
12 Mar 2013 by bhavesh002
hi friends i try to run python script which fetch data from Bloomberg but it give me error given below my all other script working fine and all required modules are installed i am using -windows server 2008 R2 standard -64 bit operating system Traceback (most recent call last): File...
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 ...
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
21 Feb 2015 by mayooran99
Is it possible to create a child class of an aspect class and allow other classes to access the methods of the child aspect class? How can I achieve this? Please advice. Im using python 2.3
23 Feb 2015 by Sergey Alexandrovich Kryukov
Please don't re-post. The post will be automatically removed, due to some abuse reports.—SA
23 Feb 2015 by Member 11474312
I have written the code to Abstract Base class, How can i access the child class method (enviorment_trees) using another class? Is it possible? from abc import ABCMeta, abstractmethod class EnvironmentAsset(object): __metaclass__ = ABCMeta ...
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...
14 Feb 2017 by Akbar Fardi
i have a codeand i have this error:ValueError:Empty vocabulary:perhaps document has only contain stop words.this is stop words.txt:a an the of as to in ifWhat I have tried:#Created on Sat May 07 21:12:41 2016from sklearn import cross_validationfrom...
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...
14 Sep 2018 by Peter Leow
Where did you get this code from? You have no clue about it. For example: 1. what is a=input ? 2. what is random.sample((1,30),a) ? 3. what is element ? 4. Many more syntax and logical errors... You really have to start to Learn Python[^] properly. BTW, ditch Python 2, go for Python 3.
1 Nov 2018 by Richard MacCutchan
code for the E-mail in python - Google Search[^]
11 Nov 2018 by BinshaS
I have my input as ROLLDIST_STAGE_NO 1 0 0 0 If my script file in csv, where 27th row and first 4 columns contain any data other than 0,then the 0 in input should be 1 as output otherwise input data should be same as output. For eg: If 27th row contains data as 0,100,0,200 then my output...
6 Dec 2018 by OriginalGriff
It's a variable resistor: it has a range of resistances (from its minimum to its maximum ) and the actual resistance across the device can be changed by the user, normally by turning a knob or moving a slider. It has nothing whatsoever to do with Python, or indeed any other form of software...
7 Feb 2020 by neveen neveen
Can anyone help me to understand the minhash GitHub - chrisjmccormick/MinHash: Example Python code for comparing documents using MinHash[^] please ?! 1- What is the purpose of using a number of files such as articles_100,articles_1000, articles_10000, and ... 2- How to add the ID like t1039 to...
7 Feb 2020 by Richard MacCutchan
The comments in the source code explain the program, and comment 3 has a link to the Minhash algorithm.
23 Mar 2020 by Richard MacCutchan
1. Learn programming 2. Write code 3. Build and test 4. Learn how to ask a question
23 Mar 2020 by CPallini
Quote: What to do for programming problem? Like any other problem, solve it!. Hint for solving: since it is a programming problem, then program for solving it. Note: The quality of the answer may occasionally depend on the quality of the...
10 Jul 2020 by Ahmad Qassym
class cl: def __init__(self,x,y): self.x = x self.y = y def multiply(self,n): self.x = self.x * n self.y = self.y * n class Cam(cl): def __init__(self,g,x,y): self.g = g ...
10 Jul 2020 by Dave Kreskowiak
You don't. Typically, the code you generate and put in the database is date/time stamped for when it was sent. When the code is entered in the page, you check to see if the timestamp plus your timeout is greater than now. If it is, the code is...
10 Jul 2020 by Greg Utas
If you're looking for a way to describe the initial position, FEN is commonly used: What are PGN & FEN?[^] If you're looking for actual code, I can't help you because I'm not a Python programmer.
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 Member 14903326
i need to convert this code to visual basic for a proyect that i did not know that was to be in viasual basic form and to be honest i don't have much time so if anyone can help me that could be amaizing What I have tried: #Se muestran los...
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...
30 Jul 2020 by ilmualam
Thank you so much for this kind of question. This is what I want to know, THANK YOU.
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.
12 Dec 2021 by asaad kittaneh
I want to allow the user to upload a picture and save it in the database(sqlite3), I tried the following, but it doesn't work: #So, Can anyone help me, I am stuck at this? I got this error: Exception in Tkinter callback Traceback (most...
24 Feb 2022 by Marguerita02
Thanks, fixed! After long searches, I found it and planning to present the homework for next week! What I have tried: I have tried it by myself but I'm still new to it, and have searched on internet,but I was warned I can't use it in the assignment
24 Feb 2022 by OriginalGriff
Quote: have searched on internet,but I was warned I can't use it in the assignment That's because the teacher needs to see your work, not someone else's - that's called "Plagiarism" and is severely frowned upon. Homework isn't given to annoy...
10 Mar 2022 by Member 15561848
64 66 81 02 73 -column 1 64 96 34 81 22 - column 2 I have two columns with 5 elements. I want to transpose it. Expected Output : 64 66 81 02 73 - column 1 61 96 34 81 22 - column 2 What I have tried: I have tried transposing but...
10 Mar 2022 by Maciej Los
Seems you want to use pandas.DataFrame.melt[^], which unpivot a DataFrame from wide to long format, optionally leaving identifiers set. Follow the link for examples.
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)
26 Jul 2022 by Richard MacCutchan
You need to use string formatting to get values printed in specific forms: formatstrings — Common string operations — Python 3.10.5 documentation[^]
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...
10 Jan 2023 by CPallini
Do you mean something like this #set up the data we will needed import numpy as np import matplotlib.pyplot as plt W = 5 # walkers X0 = 0 T = 1 #total time dt = .001 #time steps N = int(T/dt) # no of time steps D = 1 ...
10 Jan 2023 by CPallini
The np.random.randn call already provides an array of Gaussian distributed values, see numpy.random.randn — NumPy v1.24 Manual[^].
10 Jan 2023 by CPallini
It is difficult to understand what you really need. I guess you have to plot the final positions of the (a conspicuous number of ) walkers in order to get a Gaussian shaped graph.
25 Jan 2023 by Member 15201926
I need to Calculate volume, area, perimeter, major axis, minor axis and eccentricity for binary image of apple, tomato, lemon, orange, guava and gooseberry. So far calculated all I would be getting same value for both volume and area, how to...
25 Jan 2023 by Richard MacCutchan
See Solid Geometry[^] for the different formulae to apply to solid shapes.
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)
22 Jun 2013 by OriginalGriff
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...A very quick search using your subject as the search term gave 49 million hits: Google Python Chess Game using AI[^]In future, please try to do at least basic research...
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.
14 Aug 2022 by OriginalGriff
"Index out of range" means exactly what it says: the collection you are indexing into does not have enough elements to cover the index value you are using. In Python, indexes run from 0 to N - 1, where N is the number of values in the collection....
18 Dec 2016 by Albert Holguin
I have no clue what "kinect" is but I do work with C++/Python binding often. There's a tool called "swig" that's a widely used method for exporting C++ to Python (and other combinations). Essentially you create interface files (*.i) that you pass to Swig (a standalone app) that generates...
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]...
22 Jun 2013 by Bilashcse
I need some chess games reference where AI is used for computers play. This AI will be implemented by A* or Hill Climbing or Heuristic search. Please help me.
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...
17 Oct 2020 by sara elmasry
Hello, I'm trying to make a virtual dressing room application with kinect. My problem is that I want to use poser for modeling, so I need to convert C++ from kinect to python. I have no experience in python! Can anybody help me please? What I...
10 Jul 2020 by Esthonia
I create verification code entering page.need to add timer and once time is finish process re start. What I have tried: I tried one method for time but time is stopes nothing happed.
22 Jul 2022 by Rodrigo 2022
hello, apparently the program works well, but I needed to consider the value 0 also in the for result, for example if I put length 5 and points 10, it should return 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 What I have tried: from math...
26 Jul 2022 by Rodrigo 2022
how to round results to 2 decimal places? What I have tried: p=10 l=5 a=0 distance = [ ] distance.append(0) for n in range(0,p): a +=(l/p)*2.9 distance.append(a) print('distance = ',distance)
25 Nov 2022 by Member 15842988
Description: in function of the Football World Cup, a friend requested you to do a program that helps you manage information about the competition. To do this, you must implement this program in Python, which you must use text file(s), to store...
1 Dec 2022 by Member 15850922
Description: in function of the Football World Cup, a friend requested you to do a program that helps you manage information about the competition. To do this, you must implement this program in Python, which you must use text file(s), to store...
10 Jan 2023 by Astroaspirent
actually, I want gaussian probability distribution from this code so what changes can I do in my code? please suggest me. What I have tried: import numpy as np import matplotlib.pyplot as plt W = 15 # walkers X0 = 0 T = 1 #total time ...
10 Jan 2023 by Astroaspirent
actually, I want a gaussian probability distribution curve. so what changes do I have to make in my code for this? please correct my code if anyone has an idea about it. thank you What I have tried: #set up the data we will needed import numpy...
26 Apr 2014 by Aravind Kashyap Sharma
I need a proper working code in python for graph coloring with input as adjacency matrix.my input file is as follows:70 1 1 0 1 1 01 0 0 1 0 1 11 0 0 1 1 1 00 1 1 0 0 1 11 0 1 0 0 0 11 1 1 1 0 0 00 1 0 1 1 0 0first line represents the number of vertices.
1 Dec 2014 by Member 10390715
I write the code read RFID tag using reader RDM880 in python. It work well but sometime when I put the card in the far distance or too fast.It will error like this and stop workingtach_7 = data[7]IndexError : string index out of rangeI want in this case it will restart. Here is my code...