Most answered questions in Python

+1 vote
2 answers

Multiple line comment in Python

Try this ''' This is a multiline comment. ...READ MORE

Jul 31, 2018 in Python by Priyaj
• 58,090 points
769 views
0 votes
2 answers

Indentation Error in Python

Use tabs instead of spaces. This is ...READ MORE

Feb 15, 2019 in Python by Shashank
• 1,370 points
683 views
0 votes
2 answers

How to use threading in Python?

 Thread is the smallest unit of processing that ...READ MORE

Apr 6, 2019 in Python by anonymous
1,055 views
+1 vote
2 answers

What is the difference between classes and labels in machine learning?

Classes and Labels both are almost same things ...READ MORE

Apr 3, 2019 in Python by SA
• 1,090 points
7,036 views
+1 vote
2 answers

Appending data to a file

First open the file that you want ...READ MORE

Jul 23, 2018 in Python by Omkar
• 69,210 points
722 views
0 votes
2 answers

Find the largest value in a dictionary

Use below running code which is simple ...READ MORE

Nov 25, 2021 in Python by Suhas
954 views
0 votes
2 answers

What are the types of dictionary in python?

There are 4 types of dictionary Empty Integer Mixed Dictionary with ...READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
701 views
0 votes
2 answers

Lists and Tuples

Lists are mutable homogeneous sequences whereas tuples ...READ MORE

Jul 17, 2018 in Python by Mrunal
• 680 points
485 views
+3 votes
2 answers

Compiled vs Interpreted Languages

Compiled languages are written in a code ...READ MORE

Dec 3, 2018 in Python by allenvarna
• 540 points
5,074 views
0 votes
2 answers

Delete a character from pythons string

If you want to remove the 'J' ...READ MORE

Jun 12, 2018 in Python by anonymous
460 views
+1 vote
2 answers

How to print first character of each word in upper case of a string in Python

class Solution:     def firstAlphabet(self, s):             self.s=s              k=''              k=k+s[0]              for i in range(len(s)):                     if ...READ MORE

Oct 28, 2020 in Python by Anurag
11,772 views
0 votes
2 answers

Obtaining a value when given a key in python dicionaries

Yes you can check below code dictionary = ...READ MORE

Nov 25, 2021 in Python by Suhas
597 views
0 votes
2 answers

Finding the index of a character in python string

You can use word.find('o') as well to ...READ MORE

Jun 1, 2018 in Python by george
• 200 points
1,254 views
0 votes
2 answers

Splitting a Python String

The split() method in Python returns a ...READ MORE

Oct 3, 2018 in Python by anonymous
490 views
0 votes
2 answers

Do-while loop in Python

A more pythonic way would be this: ``` while ...READ MORE

Jul 6, 2020 in Python by Composer3
1,149 views
0 votes
2 answers

Manually raising (throwing) an exception in Python

Exception handling issues in python can easily ...READ MORE

Jan 18, 2019 in Python by nick
• 140 points
17,121 views
0 votes
2 answers

How do I copy a file in python?

copy a file in python  from shutil ...READ MORE

Mar 27, 2019 in Python by rajesh
• 1,270 points
971 views
+1 vote
2 answers

Measuring the distance between pixels on OpenCv with Python

You can try this: Mat pts1(nPts, 1, CV_8UC2), ...READ MORE

Aug 24, 2018 in Python by Omkar
• 69,210 points
10,159 views
0 votes
2 answers

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

Apr 2, 2019 in Python by anonymous
5,366 views
0 votes
2 answers

What is the use of Python language?

python is general purpose programming language.it very ...READ MORE

Mar 15, 2019 in Python by rajesh kumar
700 views
0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

Nov 27, 2018 in Python by Rupali
29,304 views
0 votes
2 answers

how to print the current time using python?

print(datetime.datetime.today()) READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
691 views
0 votes
2 answers

multi line comment

‘’’ This is the way to Enter multi ...READ MORE

Jul 16, 2018 in Python by Priyaj
• 58,090 points
413 views
0 votes
2 answers

Unable to use print statement in python3

print will work when you use print("Your ...READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
878 views
+1 vote
2 answers

View onto a numpy array?

 just index it as you normally would. ...READ MORE

Oct 18, 2018 in Python by roberto
694 views
+2 votes
2 answers

In a list of dictionaries, how can I find the minimum calue in a common dictionary field.

There are several options. Here is a ...READ MORE

Apr 10, 2018 in Python by charlie_brown
• 7,720 points
1,086 views
+2 votes
2 answers

How can I plot a k-dsitance graph using python?

Hi there, instead of sklearn you could ...READ MORE

Apr 10, 2018 in Python by charlie_brown
• 7,720 points
4,667 views
+1 vote
2 answers

How to resize the image canvas to maintain a square aspect ratio

down voteacceptedUsing OpenCVYou can use resize() in OpenCV to ...READ MORE

Apr 4, 2018 in Python by charlie_brown
• 7,720 points

edited Jul 11, 2023 by Khan Sarfaraz 1,283 views
+2 votes
2 answers

How to use BeatifulSoup for webscraping?

your programme is fine until you start ...READ MORE

Apr 4, 2018 in Python by charlie_brown
• 7,720 points
752 views
+2 votes
2 answers

How to make a laplacian pyramid using OpenCV python?

down voteacceptTheeThe problem is that you're iterating ...READ MORE

Apr 3, 2018 in Python by charlie_brown
• 7,720 points
4,486 views
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
5,408 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
978 views
0 votes
1 answer

What is the algorithm to find the sum of prime numbers in the input in python

To find the sum of prime numbers ...READ MORE

Mar 1 in Python by Shubh Saxena
210 views
0 votes
1 answer

How to Concatenate Lists in Python?

In Python, you can concatenate lists using ...READ MORE

Dec 29, 2023 in Python by Anu
208 views
0 votes
1 answer

Sum of prime numbers from m to n in python

def is_prime(number):     if number < 2:         return False     for i ...READ MORE

Jan 5 in Python by Ali
301 views
0 votes
1 answer

What does // means in Python?

In Python, when you use //, it ...READ MORE

Dec 29, 2023 in Python by Vani
217 views
0 votes
1 answer

Command python execinterminal icon not found

When the "command Python execInTerminal" icon or ...READ MORE

Nov 29, 2023 in Python by anonymous
• 3,320 points
674 views
0 votes
1 answer

Why am I getting the syntax error SyntaxError invalid syntax in a line that contains fully valid syntax?

A "SyntaxError: invalid syntax" is a common ...READ MORE

Oct 18, 2023 in Python by anonymous
• 3,320 points
703 views
0 votes
1 answer

What do "init" and "self" do in python ?

In Python, `init` and `self` are related ...READ MORE

Oct 5, 2023 in Python by anonymous
• 3,320 points
475 views
0 votes
1 answer

Python urllib2 login to minecraft net

Why not use Selenium over urllib? Selenium ...READ MORE

Sep 25, 2023 in Python by Rajarshi
• 470 points
302 views
0 votes
1 answer

Replacements for switch statement in Python?

To get the same function as a ...READ MORE

Feb 16, 2023 in Python by Rishu
• 300 points
888 views
0 votes
1 answer

Removing duplicates in lists

1)To get rid of duplicate items, convert ...READ MORE

Feb 16, 2023 in Python by Rishu
• 300 points
699 views
0 votes
1 answer

Relative imports in Python 3

Because the first statement, from.mymodule import myfunction, ...READ MORE

Feb 16, 2023 in Python by Rishu
• 300 points
722 views
0 votes
1 answer

Error: 'int' object is not subscriptable - Python

int([x[age1]]) You are attempting to access the age1 index ...READ MORE

Feb 16, 2023 in Python by Rishu
• 300 points
687 views
0 votes
1 answer

Why is `(True, True, True) == True, True, True` not True in Python?

Operator precedence. You're actually checking equality between (True, ...READ MORE

Jan 4, 2023 in Python by Elton
• 400 points
475 views
0 votes
1 answer

What is the data type of (1) in python?

Typecasting is the process of converting one ...READ MORE

Jan 4, 2023 in Python by Elton
• 400 points
461 views
0 votes
1 answer

Python Math - TypeError: 'NoneType' object is not subscriptable

“TypeError: 'NoneType' object is not subscriptable” is ...READ MORE

Jan 4, 2023 in Python by Elton
• 400 points
771 views
0 votes
1 answer

How do I use method overloading in Python?

It's method overloading, not method overriding. And in Python, ...READ MORE

Jan 4, 2023 in Python by Elton
• 400 points
298 views
0 votes
1 answer

Python vs Cpython

So what is CPython? CPython is the original Python implementation. ...READ MORE

Jan 4, 2023 in Python by Elton
• 400 points
472 views
0 votes
1 answer

ValueError: setting an array element with a sequence

The problem is the shape of the ...READ MORE

May 1, 2022 in Python by narikkadan
• 63,420 points
1,969 views