THIS Is VERY Useful! #code #programming #python

preview_player
Показать описание
This is very useful! #code #programming #python
Рекомендации по теме
Комментарии
Автор

M > J > C
Strings are compared character by character based on the order in Ascii

Wineblood
Автор

The default makes perfect sense, as max(arr) should be equivalent to sort(arr)[-1], and sorting alphabetically is the only reasonable solution in this case

TheTriggor
Автор

It does NOT feel random.
The reason why the string 'Mario' in the list is the max value, is because its going by alphabetical order. C, J, M. Where the M is considered the highest value in the alphabet sequence.

TwstedTV
Автор

The set of strings is actually a poset, and the relation used for ordering is the alphabetical order.

markusklyver
Автор

Yeah… these builtin functions are very versatile. I like min, max, map, zip, enumerate, sorted, and reversed. I always try to use filter() but end up writing my own generator comprehension anyway.

One common thing I use map for is string concatenation over an array of non-string types, such as:
arr = [6, 1, 8]
print(‘ -> ‘.join(map(str, arr)))

Can’t do join(arr) but you can do join(map(str, arr)). Useful function! It’s definitely useful in other cases as well.

And zip() is my favorite one. I wrap enumerate() around it very frequently.

JordanMetroidManiac
Автор

Len is not a method. It identifies as a function. A built in, even.

DrDeuteron
Автор

Python developer learns glibc's strncmp function 🤣

Mariomm_marti
Автор

Really useful if you have embedded lists too

andres.igmendez
Автор

What is the name of the font and theme?

jonathaneugeniosandovalmar
Автор

The short is alright but please why would you say that it feels a bit random, that just causes confusion. Obviously it's not random. By default, max uses the greater than (I believe) operator implementation of the values in the list. For strings, this is defined as the alphanumerical difference, so if the first non matching character encountered is greater than the other.

niels
Автор

Discovered basic functionality available in Python. Nice

ScepticEngineer
Автор

It’s a lexicographic sort by Unicode code point. Too many comments here are saying it’s alphabetical or ASCII based. Alphabetical would be case-insensitive.

rezwhap
Автор

max of strings is what comes at the end of list sorted alphabetically. just like in SQL

osomartinez
Автор

Python can either be easy if you know or Confusing when you can’t figure out how it can be figured out

nexsynthzer_beatbox
Автор

So frustrating that you don't run the second version of the function.

thatpaulschofield
Автор

Name of the application and version pls?

tabrezahamed
Автор

It's getting more interesting if you try max using different collations and names with diacritics, like with Polish names 😂

Amstelchen
Автор

Went into this video not expecting much but this is actually very neat

matthewsaucedo
Автор

It's probably not random it's printing out output on the basis of how we check words in a dictionary.

HR-pzts
Автор

It's quite easy, really. Mario has more coins than Jeff and Carlos

yourDecisin