Latest questions in Python

0 votes
0 answers

Python list error: [::-1] step on [:-1] slice

I thought I understood the basics of ...READ MORE

Dec 20, 2022 in Python by erzan
• 630 points
165 views
0 votes
0 answers

How can I find the first occurrence of a sub-string in a python string?

I'd like to locate the first index ...READ MORE

Nov 24, 2022 in Python by sarit
• 1,830 points
353 views
0 votes
0 answers

How to check whether a variable is a class or not?

I was wondering how to check whether ...READ MORE

Nov 24, 2022 in Python by sarit
• 1,830 points
249 views
0 votes
0 answers

Repeating triangle pattern in Python

Depending on the integer input, I need ...READ MORE

Nov 24, 2022 in Python by sarit
• 1,830 points
297 views
0 votes
0 answers

Is it possible to get a list of keywords in Python?

I want to obtain a string list ...READ MORE

Nov 24, 2022 in Python by sarit
• 1,830 points
299 views
0 votes
0 answers

'for' loop in one line in Python

When I tried to use a for statement in ...READ MORE

Nov 24, 2022 in Python by sarit
• 1,830 points
386 views
0 votes
0 answers

Object Oriented Python for area of triangle

Write a Python Program(with class concepts) to ...READ MORE

Nov 22, 2022 in Python by sarit
• 1,830 points
730 views
0 votes
0 answers

How do you move tree with ignore patterns in python

with the shutil.copytree I can copy an ...READ MORE

Nov 22, 2022 in Python by sarit
• 1,830 points
686 views
0 votes
0 answers

python reverse phone lookup with twilio

I've been trying to figure out how ...READ MORE

Nov 22, 2022 in Python by sarit
• 1,830 points
401 views
0 votes
0 answers

How can I "count from the back" in python lists?

Say I have a list l = ['P','y','t','h','o','n'] I ...READ MORE

Nov 22, 2022 in Python by sarit
• 1,830 points
206 views
0 votes
0 answers

Visualize the full chess board from the library python-chess on line command

I am working a chess game based ...READ MORE

Nov 22, 2022 in Python by sarit
• 1,830 points
866 views
0 votes
0 answers

Python list error: step on slice with [:-1]

I believed I was familiar with the ...READ MORE

Nov 17, 2022 in Python by Samuel
• 460 points
396 views
0 votes
0 answers

In Python, how do I declare an array?

In Python, how do I declare an ...READ MORE

Nov 17, 2022 in Python by Samuel
• 460 points
384 views
0 votes
0 answers

Random word generator in Python

I'm essentially working on a project where ...READ MORE

Nov 17, 2022 in Python by Samuel
• 460 points
915 views
0 votes
0 answers

In Python, what does a "r" mean before a string?

In Python, what does a "r" mean ...READ MORE

Nov 17, 2022 in Python by Samuel
• 460 points
204 views
0 votes
0 answers

What is the primary language used to create Python?

What is the primary language used to ...READ MORE

Nov 17, 2022 in Python by Samuel
• 460 points
223 views
0 votes
0 answers

How to define a two-dimensional array?

The following is how I want to d ...READ MORE

Nov 17, 2022 in Python by Ashwini
• 5,430 points
207 views
0 votes
0 answers

Concatenating two one-dimensional NumPy arrays

How do I concatenate two one-dimensional arrays ...READ MORE

Nov 16, 2022 in Python by Ashwini
• 5,430 points
421 views
0 votes
0 answers

What does an 'r' represent before a string in python?

Why do we put a r before ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
464 views
0 votes
0 answers

Base language of Python

What is the base language is Python ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
388 views
0 votes
0 answers

What is the meaning of "int(a[::-1])" in Python? [duplicate]

I don't get this at all. In ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
340 views
0 votes
0 answers

Reverse a string in Python

The str object in Python doesn't have ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
305 views
0 votes
0 answers

Replacements for switch statement in Python?

I want to create a Python function ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
363 views
0 votes
0 answers

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

I'm instructing my software to print out ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
358 views
0 votes
0 answers

How do I reverse a list or loop over it backwards?

How can I perform a Python reverse ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
209 views
0 votes
0 answers

'str' object has no attribute 'decode'. Python 3 error?

'decode' is not an attribute of the ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
383 views
0 votes
0 answers

How can I convert a list to a string using Python?

How can I convert a list to ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
361 views
0 votes
0 answers

'python' is not recognized as an internal or external command [duplicate]

I recently got Python Version 2.7.5, and ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
417 views
0 votes
0 answers

Does Python have a ternary conditional operator?

Is there a ternary conditional operator in Python? READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
295 views
0 votes
0 answers

How do I sort a dictionary by value?

I have some dictionary of values that ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
302 views
0 votes
0 answers

Error: 'int' object is not subscriptable - Python

I was experimenting with a straightforward piece ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
757 views
0 votes
0 answers

Initialising an array of fixed size in Python

I want to declare an array or ...READ MORE

Aug 11, 2022 in Python by krishna
• 2,820 points
1,006 views
0 votes
0 answers

What are the differences between numpy arrays and matrices? Which one should I use?

What are each's advantages and drawbacks? I've noticed ...READ MORE

Aug 8, 2022 in Python by krishna
• 2,820 points
432 views
0 votes
0 answers
0 votes
0 answers

Flattening a list of NumPy arrays?

I have data in a list type ...READ MORE

Aug 5, 2022 in Python by krishna
• 2,820 points
815 views
0 votes
0 answers

Sorting arrays in NumPy by column

How can I sort a numpy array ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
357 views
0 votes
0 answers

Java : Sort integer array without using Arrays.sort()

I have this assignment- Write java program ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
1,792 views
0 votes
0 answers

matrix multiplication of arrays in python

I am having trouble finding a solution ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
547 views
0 votes
0 answers

Combined mean and standard deviation from a collection of NumPy arrays of different shapes

Consider that I have a numpy array ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
555 views
0 votes
0 answers

Concatenate two numpy arrays in the 4th dimension

I got two numpy arrays in three ...READ MORE

Aug 1, 2022 in Python by krishna
• 2,820 points
295 views
0 votes
0 answers

Python numpy array of numpy arrays

I have a requirement. I need to ...READ MORE

Aug 1, 2022 in Python by krishna
• 2,820 points
302 views
0 votes
0 answers

How to prettyprint a JSON file?

May 27, 2022 in Python by Kichu
• 19,050 points
278 views
0 votes
0 answers

pip3: command not found but python3-pip is already installed

I am not able to use  pip3 ...READ MORE

May 27, 2022 in Python by Kichu
• 19,050 points
3,632 views
0 votes
0 answers

Extract a page from a pdf as a jpeg

How can I  save a certain page ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
219 views
0 votes
0 answers

How do I access environment variables in Python?

May 26, 2022 in Python by Kichu
• 19,050 points
558 views
0 votes
0 answers

Python - TypeError: Object of type 'int64' is not JSON serializable

My data frame has store names and ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
2,165 views
0 votes
0 answers

Find the minimum strength someone must have in the beginning so that he can cross N cells (Interview question)

Problem Statement: Mustafa wants to cross a dungeon. ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
1,896 views
0 votes
0 answers

how to merge two data frames based on particular column in pandas python?

I want to  merge two data frames: df1 company,standard tata,A1 cts,A2 dell,A3 df2 company,return tata,71 dell,78 cts,27 hcl,23 I ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
241 views
0 votes
0 answers

memory error in python

I am working on a  program that ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
527 views
0 votes
0 answers

How can I install XGBoost package in python on Windows

I am using windows 64bit os and ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
246 views