python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
Convert list with one item to item itself in dict value
For example, there is a dictionary with key-value pairs, where the values are lists with different "content". Some lists have only one element. These elements can be different types of data....
gremur
Votes: 0
Answers: 3
python oneliner, more than one way to do it?
Interactively one can do:
$ python3 -c "
> import time
> while True:
> print('Two more weeks')
> time.sleep(1)
>
> "
Two more weeks
Two more weeks
Two more weeks
^CTraceback (most recent call la...

Hannu
Votes: 0
Answers: 2
How to calculate sum of reciprocals with integers?
I would like to calculate the sum of reciprocals of a list of integers (and see if it is larger or equal to 1):
I want to work with integers to avoid floating-point rounding issues. To do so, I want ...
Rémi Baudoux
Votes: 0
Answers: 3
Only if statement and no else statement on 1 line
Question:
I know it's possible to just put an if statement on one line but is there a way to do it so that PEP8 doesn't reformat it to be on two lines? I know that you can put it on two lines but that...

Liam
Votes: 0
Answers: 2