Use a built-in function 'enumerate' if you need to loop over a list and you also want to know

preview_player
Показать описание
There's no built-in ternary operator in some kind of a form "? ... :", but there is a so-called conditional expressions, where you can check the condition and offer two results that can be used in either situation.

#conditionaloperator #ternary #ifelse #python3 #programminginpython #iteration #oddoreven #codingvideo #coding
Рекомендации по теме
Комментарии
Автор

To me it seems like you just want to make as many as these as possible to satisfy the YouTube algorithm (which is fair enough), but you fail to properly explain what the enumerate function actually does in your description and you fixed a syntax error off camera, which indicates to me that you just don't care to teach properly. You don't even explain when these functions are useful, which will just lead to bad Python programmers.

immathiasyde
Автор

Good content. Which IDE or text editor you use?

zeeshanahmad
Автор

First, you aren't showing what the second argument of enumerate does. Second, what you've written is a syntax error and not the Python file you're executing, since you've ended a line without closing the parentheses or having a comma or backslash as its last token.

erikkonstas