# Coding

## GitHub Copilot

This tool provides autocomplete style suggestions as you code. It autocompletes on-the-fly but also allows for code generation based on comments such as:

{% code title="app.py" lineNumbers="true" %}

```python
# Write a product dataclass with information about the price, picture, url and description

################### Example of generated code ###################
from dataclasses import dataclass

@dataclass
class Product:
    price: float
    picture: str
    url: str
    description: str
    
    def __post_init__(self):
        self.price = round(self.price, 2)
        
    def __str__(self):
        return f"Product(price={self.price}, picture={self.picture}, 
        url={self.url}, description={self.description})"

# Write a function that given a list of products, returns the cheapest and the most expensive one

################### Example of generated code ###################
from typing import List

def get_cheapest_most_expensive(products: List[Product]) -> (Product, Product):
    if len(products) == 0:
        return None, None
    elif len(products) == 1:
        return products[0], products[0]
    else:
        cheapest = products[0]
        most_expensive = products[0]
        for product in products[1:]:
            if product.price < cheapest.price:
                cheapest = product
            if product.price > most_expensive.price:
                most_expensive = product
        return cheapest, most_expensive
```

{% endcode %}

{% embed url="<https://github.com/features/copilot>" %}

## Ghostwriter

It helps with code autocompletion and development by recommending code based on your operations.

{% embed url="<https://replit.com/site/ghostwriter>" %}

{% embed url="<https://youtu.be/G7N08yXqZbk>" %}

## Ask Command

With this app, you describe what do you want to do or code in natural language, and it suggest you a command. It uses Open AI's GPT-3 to come up with the best command.

{% embed url="<https://askcommand.com>" %}

<figure><img src="https://4092288392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY8AeUFC5KYkaUv3lbFhX%2Fuploads%2F02kElPQj6Wk2kGCb3gyS%2Fask-command.png?alt=media&#x26;token=cea28661-855d-43c0-a3e0-07604f83334b" alt=""><figcaption></figcaption></figure>
