Here's the code:
```python
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
# Load the breast cancer dataset
data = load_breast_cancer()
X = data.data # Input features
y = data.target # Output variable
# Perform train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# Apply Logistic Regression
model = LogisticRegression()
model.fit(X_train, y_train)
# Check training and test scores
train_score = model.score(X_train, y_train)
test_score = model.score(X_test, y_test)
print("Training Score:", train_score)
print("Test Score:", test_score)
```
In the code above, we first import the necessary libraries: `load_breast_cancer` from `sklearn.datasets` to load the breast cancer dataset, `train_test_split` from `sklearn.model_selection` to split the data into training and test sets, and `LogisticRegression` from `sklearn.linear_model` to apply logistic regression.
We load the dataset and assign the input features to `X` and the output variable to `y`. Then, we perform a train-test split using 80% of the data for training (`X_train`, `y_train`) and 20% for testing (`X_test`, `y_test`).
Next, we create a logistic regression model and fit it to the training data using the `fit` method. Finally, we calculate and print the training and test scores using the `score` method.
Please note that this code assumes you have scikit-learn library installed. If you haven't installed it yet, you can do so by running `pip install scikit-learn` in your Python environment.