from sklearn.ensemble import VotingClassifier
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression

iris = load_iris()
X = iris.data
y = iris.target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

clf1 = DecisionTreeClassifier(max_depth=2)
clf2 = LogisticRegression(max_iter=1000)

voting_clf = VotingClassifier(
    estimators=[('dt', clf1), ('lr', clf2)], 
    voting='soft'
)

voting_clf.fit(X_train, y_train)
score = voting_clf.score(X_test, y_test)
print(f"Accuracy: {score:.3f}")