Most voted questions in Python

0 votes
1 answer

Where is builtins module located?

The module is built-in to the python ...READ MORE

Jun 19, 2019 in Python by SDeb
• 13,300 points
893 views
0 votes
1 answer

Combine selector conditions

In a nutshell, you can do: A[:, range(3) ...READ MORE

Jun 19, 2019 in Python by SDeb
• 13,300 points
487 views
0 votes
2 answers

Python error "pygame.error: Couldn't open pygame.png"

add import os at top of your ...READ MORE

Sep 25, 2020 in Python by anonymous
1,422 views
0 votes
1 answer

Package installed but still says "ImportError: No module named pygame.locals"

So Harsha, you Import the module first ...READ MORE

Jun 18, 2019 in Python by Varsha
3,644 views
0 votes
1 answer

Python error "ImportError: No module named pygame.locals"

You need to download and install the ...READ MORE

Jun 18, 2019 in Python by Greg
6,244 views
0 votes
0 answers

How can we read a text file in a list in python?

Can you give the sample code as ...READ MORE

Jun 18, 2019 in Python by Waseem
• 4,540 points
373 views
0 votes
0 answers

How can you print the date in a regular format in python?

Is there a module or package in ...READ MORE

Jun 18, 2019 in Python by Waseem
• 4,540 points
321 views
0 votes
1 answer

How to synchronize python lists?

threading provides Lock objects if you need to protect an ...READ MORE

Jun 18, 2019 in Python by SDeb
• 13,300 points
1,391 views
0 votes
1 answer

Get bbox in data coordinates in matplotlib

I'm not sure how you got the ...READ MORE

Jun 18, 2019 in Python by SDeb
• 13,300 points
4,492 views
0 votes
1 answer

Python function to find a list of all keywords

You can use the keyword module for ...READ MORE

Jun 17, 2019 in Python by Ayman
8,608 views
0 votes
1 answer

Python function to check if a given string is a keyword

You can get the list of keywords ...READ MORE

Jun 17, 2019 in Python by Drishya
1,960 views
0 votes
1 answer

python code to find if an array is monotonic

Hey Harsha, try out this code: def monotonic(a): ...READ MORE

Jun 17, 2019 in Python by Yesha
2,199 views
0 votes
1 answer

Python Error saying "NameError: global name 'true' is not defined"

It's a very small mistake. Change true ...READ MORE

Jun 17, 2019 in Python by Vinayak

edited Oct 7, 2021 by Sarfaraz 15,582 views
0 votes
1 answer

What does the map() method do in Python?

The map() function in Python is a ...READ MORE

Jun 17, 2019 in Python by anonymous
599 views
0 votes
1 answer

Using lambda functions to solve Algebra

Python lambda functions can be used to ...READ MORE

Jun 17, 2019 in Python by anonymous
2,642 views
0 votes
0 answers

What does a ternary conditional operator do in python?

Can you give an example using a ...READ MORE

Jun 17, 2019 in Python by Waseem
• 4,540 points
521 views
0 votes
0 answers

Does python support encapsulation?

If it does, how is it any ...READ MORE

Jun 17, 2019 in Python by Waseem
• 4,540 points
562 views
0 votes
2 answers

Check if there exists two elements in the array whose sum is equal to the sum of the entire array

You can try something like this Harsh: def ...READ MORE

Jun 17, 2019 in Python by Ayman
3,324 views
0 votes
0 answers

Python error "IndexError: list index out of range"

I am trying to execute the following ...READ MORE

Jun 17, 2019 in Python by Alok
7,221 views
0 votes
1 answer

Reconstruct an array by replacing every element with a[[i-1]%K] - Python

Hey varsha, Have a look at this ...READ MORE

Jun 14, 2019 in Python by Miya
1,174 views
0 votes
0 answers

How can I find the files and skip the directories using os.listdir in python?

When I am using os.listdir I am ...READ MORE

Jun 14, 2019 in Python by Waseem
• 4,540 points
569 views
0 votes
0 answers

What is the procedure to list all the files in the directory?

How am i supposed list all the ...READ MORE

Jun 14, 2019 in Python by Waseem
• 4,540 points
315 views
0 votes
1 answer

Length and dimensions of NumPy arrays

The length of NumPy arrays can be ...READ MORE

Jun 14, 2019 in Python by Wajiha
• 1,950 points
1,074 views
0 votes
1 answer

How to check if a website allows web scraping?

To check if a website allows web ...READ MORE

Jun 14, 2019 in Python by Wajiha
• 1,950 points
15,725 views
0 votes
1 answer

Python array multiply

When you multiply a sequence by X in Python, ...READ MORE

Jun 14, 2019 in Python by SDeb
• 13,300 points
3,150 views
0 votes
1 answer

How to fill a list?

Consider the usage of extend: >>> l = [] >>> ...READ MORE

Jun 14, 2019 in Python by SDeb
• 13,300 points
473 views
0 votes
1 answer

Error while converting a list into a numpy array

The only possible reason I could think ...READ MORE

Jun 14, 2019 in Python by Rhea
2,405 views
0 votes
1 answer

Python Error ""ValueError: could not broadcast input array from shape (4) into shape (1000)""

There are better ways of achieving the ...READ MORE

Jun 14, 2019 in Python by Faiza
29,719 views
0 votes
0 answers

How does function definition work in python?

Is it same as other programming languages ...READ MORE

Jun 13, 2019 in Python by Waseem
• 4,540 points
380 views
0 votes
0 answers

How can you preserve timezone information in python?

What is the use of strfttime()  and ...READ MORE

Jun 13, 2019 in Python by Waseem
• 4,540 points
331 views
0 votes
1 answer

Information about functions or classes in Python

Information about functions, classes, modules, etc can ...READ MORE

Jun 13, 2019 in Python by Nisa
• 1,090 points
490 views
0 votes
1 answer

Low precision and high recall application - Logical regression

In situations where you wish to reduce ...READ MORE

Jun 13, 2019 in Python by Meg
2,638 views
0 votes
1 answer

High Precision value and low recall value - Logistic regression

You use high positive and low recall ...READ MORE

Jun 13, 2019 in Python by Greg
1,614 views
0 votes
2 answers

Python Error "UnicodeEncodeError: 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128)"

import csv import sys reload(sys) sys.setdefaultencoding('utf8') data = [["a", "b", u'\xe9']] with ...READ MORE

Jun 28, 2019 in Python by anonymous
13,311 views
0 votes
1 answer

Python error "pandas.errors.ParserError: Error tokenizing data"

Pandas do not take .xlsx files. Rename ...READ MORE

Jun 13, 2019 in Python by Rhea
18,734 views
0 votes
1 answer
0 votes
1 answer

numpy all differing from builtin all

Numpy.all does not understands generator expressions. From the ...READ MORE

Jun 13, 2019 in Python by SDeb
• 13,300 points
515 views
0 votes
1 answer

Serving static files on heroku

Try using Amazon s3 for storing static ...READ MORE

Jun 13, 2019 in Python by SDeb
• 13,300 points
2,927 views
0 votes
0 answers

How can you use html parser in python?

Is it only used while web scraping? What ...READ MORE

Jun 12, 2019 in Python by Waseem
• 4,540 points
402 views
0 votes
1 answer

What exactly is invalid syntax error?

please solve this error   def TakeImages():     Id=(text.get())   ...READ MORE

Jul 20, 2020 in Python by Prince kumar
1,636 views
0 votes
1 answer

Why are Lists faster than character arrays for string concatenation?

It's true that in the list-append method, ...READ MORE

Jun 12, 2019 in Python by SDeb
• 13,300 points
1,673 views
0 votes
1 answer

What are higher-order functions?

Higher-order functions are those functions that either ...READ MORE

Jul 25, 2019 in Python by Fata
• 1,050 points
757 views
0 votes
1 answer

Is it possible to concatenate QuerySets?

You can start with this- from itertools import ...READ MORE

Jun 12, 2019 in Python by SDeb
• 13,300 points
1,461 views
0 votes
1 answer

Please explain the logic of giving a name to lambda function when it is actually a nameless function?

This is done because these functions are ...READ MORE

Jun 12, 2019 in Python by Wajiha
• 1,950 points
722 views
0 votes
1 answer

Python code to send an email with an attachment

Hi @Vipul, try out this code. I've ...READ MORE

Jun 11, 2019 in Python by Adil
14,545 views
0 votes
1 answer

Python code to send an email message from 1 email id to another

Hi @Deb, try out the following code: import ...READ MORE

Jun 11, 2019 in Python by Picentra
876 views
0 votes
1 answer

Python code to send an email message from my gmail to many others

Hey @Varsha, you can try out the ...READ MORE

Jun 11, 2019 in Python by Travis
858 views
0 votes
1 answer

Shallow copying vs Deep copying

If you have an object and you ...READ MORE

Jun 11, 2019 in Python by Kyraa
953 views
0 votes
1 answer

Flatten 2D list in Python

Here's an example for you: mat = [[10, ...READ MORE

Jun 11, 2019 in Python by Adi
611 views
0 votes
1 answer

What are frozen sets in python?

A frozen set in Python is a ...READ MORE

Jun 11, 2019 in Python by Nisa
• 1,090 points
2,749 views