I wrote a small environment to write exercises:
\documentclass{book}
\usepackage{lipsum}
\usepackage{tocloft}
\usepackage{xparse}
\newcommand{\listofexercises}{List of exercises}
\newlistof{exercise}{exp}{\listofexercises}
% Restart counter at each new chapter
\makeatletter
@addtoreset{exercise}{chapter}
\makeatother
% Exercise environment
\newenvironment{exercise}[1][]{%
\refstepcounter{exercise}
\par\noindent\textbf{Exercice \thechapter.\theexercise} {#1}
\newline
\addcontentsline{exp}{exercise}{%
Exercice \thechapter.\theexercise
\ifx&\else\ -- #1\fi
}\par
}{
\newline%
}
\begin{document}
\mainmatter
\chapter{Foo}
\lipsum[1][1-3]
\begin{exercise}
What is the difference between a duck?
\end{exercise}
\lipsum[2][1-3]
\begin{exercise}
What is the answer to life the universe and everything?
\end{exercise}
\begin{exercise}[Don't answer yes]
Are you human?
\end{exercise}
\chapter{Bar}
\begin{exercise}[Impossible?]
If you enjoy wasting time, is that time really wasted?
\end{exercise}
\backmatter
\listofexercise
\end{document}
Sadly, the spacing doesn't help to clearly identify the exercise. The parindent are confusing and the spacing is not great.
Some workaround would set no parindent for the whole document and add a double \newline after the environment, but I don't think it is a good solution.
Moreover if I add a new line after an exercise I get an error. With this:
\begin{exercise}
What is the answer to life the universe and everything?
\end{exercise}
I get this:
! LaTeX Error: There's no line here to end.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.44 \end{exercise}


\newtheorem{example}{Example}[chapter]or similar. If you want you own list of these you can see some of the solutions here https://tex.stackexchange.com/q/74857/106804 – oliversm Aug 08 '20 at 00:16