Counters | Python Methods and Functions

** **

## Tutorials

### Python OpenCV | cv2.putText () method

### numpy.arctan2 () in Python

### Python | os.path.realpath () method

### Python OpenCV | cv2.circle () method

### Python OpenCV | cv2.cvtColor () method

### Python - Move item to the end of the list

### time.perf_counter () function in Python

### Check if one list is a subset of another in Python

### Python | os.path.join () method

### Python | os.path.expanduser () method

### Replace negative value with zero in Numpy array

### Python | Convert nested dictionary list to Pandas dataframe

### TimeField — Django Models

### Python | os.path.isdir () method

### Python OpenCV cv2.line () method

### numpy.poly1d () in Python

### Numpy.sqrt () in Python

### Split nested list into two lists in Python

### Python program to convert camel case string to snake case

### Python | Pandas DataFrame.reset_index ()

### Binning in Data Mining

### Python | Add suffix / prefix to strings in a list

### Dunn index Python

### Python - Print list vertically

Given a list of numbers, your task is to remove and print every third number from the list of numbers until the list becomes empty.

Examples:

Input: [10, 20, 30, 40, 50, 60, 70, 80, 90]

Output: 30 60 90 40 80 50 20 70 10

Explanation:

The first third element encountered is 30, after 30 we start the count from 40 for the next third element which is 60, after that 90 is encountered. Then again the count starts from 10 for the next third element which is 40. Proceeding in the same manner as we did before we get next third element after 40 is 80. This process is repeated until the list becomes empty.Input: [1, 2, 3, 4]

Output: 3 2 4 1

Explanation:

The first third element encountered is 3, after 3 we start the count from 4 for the next third element which is 2. Then again the count starts from 4 for the next third element which is 4 itself and finally the last element 1 is printed.

** Approach The index of the list starts at 0 and the first third element will be at position 2. Go through until the list is empty and each time find the index of the next third element and print its corresponding value. After printing, reduce the length of the list. **

Output:

3 2 4 1

X
# Submit new EBook

` ` |