Chalarangelo / 30-seconds-of-python

Short Python code snippets for all your development needs
https://www.30secondsofcode.org/python/p/1
Creative Commons Attribution 4.0 International
8.83k stars 1.26k forks source link

update_All_equal #155

Closed ze-dev closed 4 years ago

ze-dev commented 4 years ago

Description

Resolves #(issue number)

What does your PR belong to?

Types of changes

Checklist:

ze-dev commented 4 years ago

Code "return lst[1:] == lst[:-1]" will compare two lists:
1st example: [2, 3, 4, 5, 6] and [1, 2, 3, 4, 5] because lst[1:] = [2, 3, 4, 5, 6] and lst[:-1] = [1, 2, 3, 4, 5]
2nd example: [1, 1, 1] and [1, 1, 1] We have to compare current and next elements of list in cycle (for i in lst), while result is True.

ze-dev commented 4 years ago

Sorry for my changes in Readme.md, I'll be more attentive.