I was wondering if there was a way to modify the theorem environment so that it interacted with sections/subsections as follows:
\section{}
\subsection{}
\begin{ex} Whatever
\end{ex}
\begin{ex}Whatever
\end{ex}
\subsection{}
\begin{ex} Whatever
\end{ex}
Would output something like
1
1.1
Exercise 1.1.1
Exercise 1.1.2
1.2
Exercise 1.2.1
Where \begin{ex} is just an environment for an "exercise".