Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
# Вывести каждый второй элемент списка. list_str = ['Python', 'C#', 'C++', 'C', 'Java', 'Lua', 'Perl', 'R', 'F#'] # На код дается 1 строка. # Решение: # Вариант 1 print(*list_str[::2]) # Вариант 2 for i in range(0, len(list_str), 2): print(list_str[i]) # Вариант 3 print(*[item for index, item in enumerate(list_str) if index % 2 == 0]) # Вариант 4 print(*list(filter(lambda item: item is not None, list(map(lambda index: list_str[index] if index % 2 == 0 else None, range(len(list_str)))))))
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)