Trending 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
379 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
421 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
323 views
0 votes
2 answers

Removing duplicates in lists

list(set(t + t2)) READ MORE

Feb 13, 2022 in Python by anonymous
510 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
675 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
577 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
361 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
265 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
304 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
297 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
384 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
256 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
246 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
229 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
225 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
307 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
303 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
232 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
207 views
0 votes
1 answer

ValueError("arrays must all be same length") ValueError: arrays must all be same length

Hi,  You need to specify index for your ...READ MORE

Jun 25, 2020 in Python by MD
• 95,440 points
28,214 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
439 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
250 views
0 votes
0 answers

TypeError: 'list' object is not callable in python

I am a beginner in Python, created ...READ MORE

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

Understanding slice notation

To answer your question let me explain ...READ MORE

Feb 4, 2022 in Python by Nandini
• 5,480 points
673 views
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
429 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
339 views
0 votes
1 answer

Difference between "while" loop and "do while" loop

The do while loop helps in executing ...READ MORE

Feb 8, 2022 in Python by Soham
• 9,700 points
446 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
380 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
248 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
317 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
231 views
0 votes
1 answer

What is the python keyword "with" used for?

The PEP343 documentation contains details regarding the ...READ MORE

Feb 9, 2022 in Python by Dev
• 6,000 points
334 views
0 votes
1 answer
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
292 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
276 views
0 votes
1 answer

What is the use of "assert" in Python?

The statement assert exists in almost every programming ...READ MORE

Feb 7, 2022 in Python by Nandini
• 5,480 points
348 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
230 views
0 votes
1 answer

Base language of Python

Python is written in C, not completely ...READ MORE

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

Is there a way to create multiline comments in Python?

In Python, you can use '''  some ...READ MORE

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

How can I count the occurrences of a list item?

For Counting the occurrences there are many ...READ MORE

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

Is there a label/goto in Python?

Since Python is a structured programming language, ...READ MORE

Feb 4, 2022 in Python by Nandini
• 5,480 points
356 views
0 votes
0 answers

testing test test

This is the most active category where ...READ MORE

Feb 4, 2022 in Python by anonymous
• 300 points
217 views
0 votes
1 answer

How to change the “tick frequency” on x or y axis in matplotlib?

You could explicitly set where you want ...READ MORE

Jan 5, 2021 in Python by Gitika
• 65,910 points
17,065 views
0 votes
1 answer

How to merge multiple json objects into a single json object using python

You may do like this but it ...READ MORE

Nov 22, 2020 in Python by Gitika
• 65,910 points
18,546 views
0 votes
0 answers

AttributeError: 'str' object has no attribute 'click'

Hey guys. i need help! I have ...READ MORE

Nov 8, 2021 in Python by anonymous
• 120 points
3,114 views
0 votes
1 answer

How to import a folder in Jupyter Notebook?

Hi@akhtar, There is no simple way to import ...READ MORE

Aug 17, 2020 in Python by MD
• 95,440 points
22,089 views
0 votes
2 answers

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Hey,  @Himanshu. It's still most likely gzipped data. ...READ MORE

Jul 27, 2020 in Python by Gitika
• 65,910 points
23,176 views
0 votes
1 answer

ImportError: No module named matplotlib.pyplot

Hi@akhtar, It seems you don't have matplotlib library ...READ MORE

Jun 22, 2020 in Python by MD
• 95,440 points
24,354 views
+1 vote
3 answers

Python error "AttributeError: 'Turtle' object has no attribute 'Shape'"

Hey @Nagya, replace python.Shape("Square") with the following: python.shape("square") Python is case ...READ MORE

Jun 19, 2019 in Python by Faiza
20,990 views
0 votes
1 answer

How to uninstall a package installed with pip install --user?

Having tested this using Python 3.5 and ...READ MORE

Dec 4, 2020 in Python by Gitika
• 65,910 points
16,719 views