Most voted questions in Python

0 votes
1 answer

Are Python sets mutable?

>>>> x = set([4, 5, 6]) Sets are ...READ MORE

Feb 18, 2022 in Python by CoolCoder
• 4,400 points
408 views
0 votes
1 answer

How can I capitalize the first letter of each word in a string?

The .title() method of a string (either ASCII or ...READ MORE

Feb 18, 2022 in Python by CoolCoder
• 4,400 points
338 views
0 votes
0 answers

Is there a difference between "==" and "is"?

In Python, are the following two tests ...READ MORE

Feb 18, 2022 in Python by Dev
• 6,000 points
255 views
0 votes
0 answers

How to return dictionary keys as a list in Python?

Now, in Python >= 3.3, I get something ...READ MORE

Feb 18, 2022 in Python by Dev
• 6,000 points
270 views
0 votes
0 answers

Why dict.get(key) instead of dict[key]?

Today, I came across the dict method get which, given a ...READ MORE

Feb 18, 2022 in Python by Dev
• 6,000 points
258 views
0 votes
0 answers

How to use string.replace() in python 3.x

The string.replace() is deprecated on python 3.x. ...READ MORE

Feb 18, 2022 in Python by Dev
• 6,000 points
267 views
0 votes
1 answer

ImportError: No module named pandas

 I just had the problem and I ...READ MORE

Feb 17, 2022 in Python by Aditya
• 7,680 points
1,137 views
0 votes
0 answers

raw_input function in Python

What is the raw_input function? Is it ...READ MORE

Feb 17, 2022 in Python by surbhi
• 3,810 points
220 views
0 votes
1 answer

Are Python sets mutable?

Python sets are data structures which are ...READ MORE

Feb 17, 2022 in Python by Dev
• 6,000 points
551 views
0 votes
1 answer

How can I capitalize the first letter of each word in a string?

By using  the .title() method of string ...READ MORE

Feb 17, 2022 in Python by Dev
• 6,000 points
483 views
0 votes
1 answer

Get a list of numbers as input from the user

value = [int(num) for num in input().split()] Output 1 ...READ MORE

Feb 17, 2022 in Python by Dev
• 6,000 points
290 views
0 votes
1 answer

raw_input function in Python

raw_input was used in Python 2 version ...READ MORE

Feb 17, 2022 in Python by Dev
• 6,000 points
445 views
0 votes
1 answer

Pytesseract : "TesseractNotFound Error: tesseract is not installed or it's not in your path", how do I fix this?

Based on my recent experience with this ...READ MORE

Feb 16, 2022 in Python by Soham
• 9,700 points
33,872 views
0 votes
1 answer

'python' is not recognized as an internal or external command

Use "py" instead of "python" from command ...READ MORE

Feb 16, 2022 in Python by CoolCoder
• 4,400 points
824 views
0 votes
1 answer

syntaxerror: "unexpected character after line continuation character in python" math

The division operator is /, not \ READ MORE

Feb 16, 2022 in Python by CoolCoder
• 4,400 points
339 views
0 votes
1 answer

Does Python have a string 'contains' substring method?

You can use in operator to access ...READ MORE

Feb 16, 2022 in Python by Nandini
• 5,480 points
340 views
0 votes
1 answer

'python' is not recognized as an internal or external command

There are multiple ways you can use: 1)Use ...READ MORE

Feb 16, 2022 in Python by Nandini
• 5,480 points
15,332 views
0 votes
1 answer

Does "IndexError: list index out of range" when trying to access the N'th item mean that my list has less than N items?

IndexError occurs when the item you want ...READ MORE

Feb 16, 2022 in Python by Nandini
• 5,480 points
257 views
0 votes
1 answer

syntaxerror: "unexpected character after line continuation character in python" math

There is a slight confusion as both ...READ MORE

Feb 16, 2022 in Python by Nandini
• 5,480 points
619 views
0 votes
1 answer

Reverse a string in Python

>>> 'hello world'[::-1] 'dlrow olleh' This is extended slice syntax. It ...READ MORE

Feb 15, 2022 in Python by CoolCoder
• 4,400 points
597 views
0 votes
1 answer

How do I get the number of elements in a list

The len() function can be used with several different ...READ MORE

Feb 15, 2022 in Python by CoolCoder
• 4,400 points
387 views
0 votes
1 answer

Reverse a string in Python

To reverse a string in Python we ...READ MORE

Feb 15, 2022 in Python by Dev
• 6,000 points
320 views
0 votes
1 answer

How do I get the number of elements in a list

items = [] items.append("apple") items.append("orange") items.append("banana") len(items) #use the ...READ MORE

Feb 15, 2022 in Python by Dev
• 6,000 points
326 views
0 votes
1 answer

Sum a list of numbers in Python

So you want (element 0 + element ...READ MORE

Feb 14, 2022 in Python by CoolCoder
• 4,400 points
2,781 views
0 votes
1 answer

How do I specify new lines on Python, when writing on files?

It is up to you to decide ...READ MORE

Feb 14, 2022 in Python by CoolCoder
• 4,400 points
422 views
0 votes
1 answer

Remove all special characters, punctuation and spaces from string

This can be done without regex: >>> string ...READ MORE

Feb 14, 2022 in Python by CoolCoder
• 4,400 points
1,130 views
0 votes
1 answer

How do I specify new lines on Python, when writing on files?

In Python \n is used for new ...READ MORE

Feb 14, 2022 in Python by Nandini
• 5,480 points
262 views
0 votes
1 answer

How can I get list of values from dict?

Here is an example to get the ...READ MORE

Feb 14, 2022 in Python by Nandini
• 5,480 points
874 views
0 votes
1 answer

Sum a list of numbers in Python

Let us take a list of Numbers ...READ MORE

Feb 14, 2022 in Python by Nandini
• 5,480 points
1,603 views
0 votes
1 answer

What does "SyntaxError: Missing parentheses in call to 'print'" mean in Python?

This error is generated when one is ...READ MORE

Feb 14, 2022 in Python by Nandini
• 5,480 points
3,399 views
0 votes
1 answer

'Conda' is not recognized as internal or external command

I was coming across the same issue ...READ MORE

Feb 11, 2022 in Python by Soham
• 9,700 points
27,340 views
0 votes
1 answer

TypeError: a bytes-like object is required, not 'str' when writing to a file in Python3

After what I observed, you would have ...READ MORE

Feb 11, 2022 in Python by Rahul
• 9,670 points
1,594 views
0 votes
1 answer

Iterating over dictionaries using 'for' loops

Here in this example the key is ...READ MORE

Feb 11, 2022 in Python by Dev
• 6,000 points
269 views
0 votes
1 answer

How to reverse a list?

A  list in Python can be reversed ...READ MORE

Feb 11, 2022 in Python by Dev
• 6,000 points
255 views
0 votes
1 answer

Converting integer to string in Python

In order to convert an object to string ...READ MORE

Feb 11, 2022 in Python by Dev
• 6,000 points
374 views
0 votes
1 answer

What exactly are iterator, iterable, and iteration?

Iteration is a process in which one ...READ MORE

Feb 11, 2022 in Python by Dev
• 6,000 points
614 views
0 votes
1 answer

"inconsistent use of tabs and spaces in indentation"

To answer your question, start with eliminating ...READ MORE

Feb 10, 2022 in Python by Rahul
• 9,670 points
1,458 views
0 votes
1 answer

Purpose of "%matplotlib inline"

The %matplotlib inline is nothing but a ...READ MORE

Feb 10, 2022 in Python by Rahul
• 9,670 points
1,264 views
0 votes
2 answers

Removing duplicates in lists

list(set(t + t2)) READ MORE

Feb 13, 2022 in Python by anonymous
540 views
0 votes
1 answer

Removing duplicates in lists

To remove duplicates from List use, set ...READ MORE

Feb 10, 2022 in Python by Nandini
• 5,480 points
503 views
0 votes
1 answer

What is the difference between tree depth and height?

To answer your question, you will have ...READ MORE

Feb 9, 2022 in Python by Rahul
• 9,670 points
1,391 views
0 votes
1 answer
0 votes
1 answer

What is the difference between Python's list methods append and extend?

Python's list methods append and extend add ...READ MORE

Feb 9, 2022 in Python by Nandini
• 5,480 points
456 views
0 votes
1 answer

When to use "while" or "for" in Python

Yes, there is a significant distinction between ...READ MORE

Feb 9, 2022 in Python by CoolCoder
• 4,400 points
302 views
0 votes
1 answer

What is the python keyword "with" used for?

It's useful when you have two or ...READ MORE

Feb 9, 2022 in Python by CoolCoder
• 4,400 points
420 views
0 votes
1 answer

How can I add new keys to a dictionary in Python?

Yes, it is possible to add new ...READ MORE

Feb 9, 2022 in Python by Nandini
• 5,480 points
342 views
0 votes
1 answer

When to use "while" or "for" in Python?

while and for are both flow control ...READ MORE

Feb 9, 2022 in Python by Nandini
• 5,480 points
245 views
0 votes
1 answer

What is the output of the following python code snippet?

for i in range(0, 10, 2):     if ...READ MORE

Feb 9, 2022 in Python by Nandini
• 5,480 points
2,131 views
0 votes
1 answer

How to convert list to string

To convert list to string in Python ...READ MORE

Feb 9, 2022 in Python by Dev
• 6,000 points
317 views
0 votes
1 answer

What is the difference between sets and lists in Python?

Lists can contain duplicates but sets cannot Sets ...READ MORE

Feb 9, 2022 in Python by Dev
• 6,000 points
726 views