Print the key of the max value in a dictionary the pythonic way Given a dictionary d where the key values pair consist of a string as key and an integer as value, I want to print the key string where the value is the maximum.  Of course I can loop over d.items(), store the maximum and its key and output the latter after the for loop. But is there a more "pythonic" way just using just a max function construct like  print max(...)
Getting key with maximum value in dictionary? I have a dictionary: keys are strings, values are integers.  Example:   stats = {'a':1000, 'b':3000, 'c': 100}   I'd like to get 'b' as an answer, since it's the key with a higher value.  I did the following, using an intermediate list with reversed key-value tuples:  inverse = [(value, key) for key, value in stats.items()] print max(inverse)[1]   Is that one the better (or even more elegant) approach?
How to view network traffic requested by a specific app? There are lots of discussion on how to see which app is requesting network connection. I have tried the following apps:  tcapturepacket wifi monitor connection tracker   However, none of them was useful. For example, for a short period of time, I uploaded a 30KB pcap file which can be viewed . Still I haven't find out which app is requesting connection and to where it is trying to connect.  I also tried to look at adb logcat, but didn't find useful information. Maybe something has been missed here. Any guess? How can I get a shapefile from a postgis query? My data is in a PostGIS database. I would like to generate a shapefile from a query. How can I do that? Bluetooth disappeared in Windows 10 I have a Lenovo G580 laptop. In the past, using Windows 8, I could use Bluetooth to connect to other devices.  Installing Windows&nbsp;10, Bluetooth simply disappeared. I can't find anything related to Bluetooth in the Device Manager, also in Settings → Devices.  There is no Windows&nbsp;10 Bluetooth driver for my laptop.  What can I do? Permanently removing apache2 It seems a simple apt-get remove apache2 does not completely remove apache2 as I can still see it on one of the processes when running top. How does one remove apache2 completely on his ubuntu server?  It's not removed indeed:  ~# which apache2 /usr/sbin/apache2 ~# whereis apache2 apache2: /usr/sbin/apache2 /etc/apache2 /usr/lib/apache2 /usr/share/apache2 /usr/share/man/man8/apache2.8.gz   But when I do apt-get remove apache2 again:  # apt-get remove apache2 Reading package lists... Done Building dependency tree Reading state information... Done Package apache2 is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. In my past experiences, I have almost never typeset my manuscripts according to the formats required by the journals to which I would like to submit. I leave my manuscripts as produced by the LaTeX article documentclass.  Recently I am wondering: Would such a behavior generally give handling editors a negative first impression? Simple undivided plane UV map not behaving as expected Does a differentiable everywhere function have a continuous derivative? If a function $f$ defined on $[a,b]$ and differentiable everywhere, does it mean that its derivative $f'(x)$ is continuous everywhere on $[a,b]$?  My understanding is 'yes'. Because if there were 'a gap' in $f'(x)$, we could integrate back to $f(x)$ and show that where the gap is, there would be a sharp "angle" where $f(x)$ is not differentiable. As per the title, what is this new feature? how can I add an overlapped anchor in both overlapped paths automatically How I can add an anchor point for each intersected selected paths in illustrator automatically?  I know smart Guide and add anchor point tool can do the job but it will add just one anchor in the front path only. If I use pathfinder outline or the scissors my paths get cut and I have to re-join them again one by one. I have a rather long footnote which breaks a listing in two parts, unnecessarily.  Since the listing is more important then the footnote I'd rather lake to have the footnote split.   Can I customize (one or all) footnotes to have a maximal length before they are continued on the next page? Or can I manually split a footnote in two to get the effect? “Are” vs. “is” after “parents and the family” Scan vs. Map vs. Apply How will Cryptography be changed by Quantum Computing? I realise this isn't a 'yes or no' question, and I apologise for asking something that could be seen as a discussion thread, but I had to ask.  I'm currently doing an EPQ in CS (specifically how QC will change Cryptography). I'm trying to gather up topics to cover, and so far I've scribbled down -  Effects -   National security, classical cryptographic methods (RSA, DSA, AES-256). Including Shor's algorithm. Communications Online services, e.g. BitCoin.   How would we counter this (not sure how better to phrase this) -   Lattice-based Multivariate Hash-based signatures Code-based cryptography   Is there anything else you'd recommend me including (as well as the above), or anything in the above you don't think I should include?   Honestly, the list above is a rough, first draft the main bulk of it... so don't it as gospel.  Best regards,  Cameron. Draft mode for pgfplots Can I use my Schengen visa for multiple purposes I was issued a Schengen visa for 90 days validity with multiple entry. Initially I planned for tourism to France and Switzerland and accordingly I have written the purpose as tourism only and I will be travelling as well for a week and coming back to India. First I am using for tourism for one week and travelling back to India.  Now, I also need to travel again to Schengen area to the same countries for business purpose for one week again. Can I use the same visa or do I need to get a new one? Determine whether $(x_n)$ converges if $x_1= a , x_{n+1} = x_n+\frac{1}{x_n}$ for $n \in \mathbb{N}$ Prove by induction that $(x+1)^n - nx - 1$ is divisible by $x^2$ Basis step has already been completed. I've started off with the inductive step as just $n=k+1$, trying to involve $f(k)$ into it so that the left over parts can be deducible to be divisible by $x^2$ but getting stuck on this inductive step. Find the minimum value of $f(x,y,z)=\frac{x^2}{(x+y)(x+z)}+\frac{y^2}{(y+z)(y+x)}+\frac{z^2}{(z+x)(z+y)}$. Find the minimum value of $f(x,y,z)=\frac{x^2}{(x+y)(x+z)}+\frac{y^2}{(y+z)(y+x)}+\frac{z^2}{(z+x)(z+y)}$ for all notnegative value of $x,y,z$.  I think that minimum value is $\frac{3}{4}$ when $x=y=z$ but I have no prove. Can the Dispel Magic spell be Readied to counter an opponent's spell? When playing as a spellcaster, is it valid the use of the Ready action to prepare Dispel Magic to counter a spell cast by an opponent? In the same vein, when declaring said action, do I have to specify which spell slot I will use when Readying the Dispel Magic spell? If that is the case, does this tactic nullify an opponent's spell? I get the impression that this is basically turning Dispel Magic into a spell with a casting time of &quot;1 reaction&quot;. Is my reading of the rules accurate? Is there a free program to (batch) change photo file's date to match EXIF? I want to specify a directory and have the software find all the photos in the directory and its sub-directories, and if they contain EXIF date/time, it sets their filesystem timestamp to match the EXIF.