Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 9v00672c1db90000000005ba

Fix the git merge conflicts

Solve the merge conflicts in the Python file

Start file
<<<<<<< HEAD
def calculate_total(items):
    """Calculate total price of items with 10% discount"""
    total = sum(item['price'] for item in items)
    return total * 0.9  # Apply 10% discount
=======
def calculate_total(items):
    """Calculate total price of items with tax"""
    total = sum(item['price'] for item in items)
    return total * 1.15  # Apply 15% tax
>>>>>>> feature/add-tax

def format_currency(amount):
<<<<<<< HEAD
    """Format amount as USD"""
    return f"${amount:.2f}"
=======
    """Format amount as EUR"""
    return f"€{amount:.2f}"
>>>>>>> feature/currency-update

def process_order(items):
    total = calculate_total(items)
<<<<<<< HEAD
    return {
        'status': 'success',
        'total': format_currency(total),
        'items_count': len(items)
    }
=======
    shipping = 5.99 if total < 50 else 0
    return {
        'status': 'processed',
        'total': format_currency(total + shipping),
        'shipping': shipping
    }
>>>>>>> feature/shipping
End file
def calculate_total(items):
    """Calculate total price of items with tax"""
    total = sum(item['price'] for item in items)
    total = total * 0.9  # Apply 10% discount
    return total * 1.15  # Apply 15% tax

def format_currency(amount):
    """Format amount as EUR"""
    return f"€{amount:.2f}"

def process_order(items):
    total = calculate_total(items)
    shipping = 5.99 if total < 50 else 0
    return {
        'status': 'processed',
        'total': format_currency(total + shipping),
        'items_count': len(items),
        'shipping': shipping
    }

View Diff

1d0
< <<<<<<< HEAD
3,7d1
<     """Calculate total price of items with 10% discount"""
<     total = sum(item['price'] for item in items)
<     return total * 0.9  # Apply 10% discount
< =======
< def calculate_total(items):
9a4
>     total = total * 0.9  # Apply 10% discount
11d5
< >>>>>>> feature/add-tax
14,17d7
< <<<<<<< HEAD
<     """Format amount as USD"""
<     return f"${amount:.2f}"
< =======
20d9
< >>>>>>> feature/currency-update
24,30d12
< <<<<<<< HEAD
<     return {
<         'status': 'success',
<         'total': format_currency(total),
<         'items_count': len(items)
<     }
< =======
34a17
>         'items_count': len(items),
37d19
< >>>>>>> feature/shipping

Solutions by @pacuna:

Unlock 1 remaining solutions by signing in and submitting your own entry
Created by: @pacuna

16 active golfers, 61 entries

Solutions by @pacuna:
58
#12 - Pablo Acuna / @pacuna

11/07/2024 at 01:58AM