To skip the first element in Python you can simply write
for car in cars[1:]:
# Do What Ever you want
or to skip the last elem
for car in cars[:-1]:
# Do What Ever you want
You can use this concept for any sequence
(not for any iterable
though).
More Related Contents:
- Python: I need a code to auto login a website with HTTPS [closed]
- python building coder for ceasar cipher
- How function is getting called without defining in python [closed]
- is my function of count the number of a specific letters in a string right? [closed]
- Locale date formatting in Python
- Importing from builtin library when module with same name exists
- AttributeError: module ‘time’ has no attribute ‘clock’ in Python 3.8
- Renaming a virtualenv folder without breaking it
- How to check if any value is NaN in a Pandas DataFrame
- How to set timeout on python’s socket recv method?
- Flask SQLAlchemy query, specify column names
- Why does Python pep-8 strongly recommend spaces over tabs for indentation? [closed]
- How to update json file with python
- How to write a file or data to an S3 object using boto3
- pip issue installing almost any library
- socket.shutdown vs socket.close
- Calling functions by array index in Python
- .xlsx and xls(Latest Versions) to pdf using python
- How can I save my secret keys and password securely in my version control system?
- Python: using a recursive algorithm as a generator
- Pip not working behind firewall
- Cython class AttributeError
- SQLAlchemy equivalent to SQL “LIKE” statement
- Python floating point number comparison
- What is the time complexity of heapq.nlargest?
- Download a spreadsheet from Google Drive / Workspace using Python
- Detecting Key Presses using win32api in Python
- Creating a custom widget in tkinter
- Python intern for non-strings
- Redirect to login page if user not logged in using FastAPI-Login package