A random forest fits many randomized trees and combines their predictions. Averaging reduces the dependence on any single fitted tree. Gradient boosting adds small trees sequentially, with each stage addressing errors in the current model. The methods have different fitting procedures even though both contain trees.
These exercises use small ensembles so they stay responsive in a browser notebook. The requested settings define a repeatable comparison, not a recommended production configuration. Fit the ensemble on training rows and keep the holdout for evaluation. A larger collection of trees does not repair leakage or the wrong outcome definition. You will build both classifiers and regressors, choosing the estimator family from the required output. Fixed seeds control randomness in this exercise but don't replace validation across samples.