#StackBounty: #lists #exercises How can line breaks be suppressed in subQuestions using Exercise?

Bounty: 100

The answers to sub-questions are often short: a) 2, b) -15, c) 21
How can I force a no-line-break for any given sub question?
MWE follows

%
%--------------------------------------------------------------------------------------------------------- %
documentclass{book}
%--------------------------------------------------------------------------------------------------------- %
%
usepackage[fleqn]{amsmath} %
usepackage{amsthm,amssymb} %
usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,driver=none,lmargin=25mm,vmargin=20mm,showframe,showcrop]{geometry} % verbose,showcrop,showframe=inner frame
usepackage[a4,frame,center]{crop} % pageframe
usepackage[lastexercise,answerdelayed]{exercise}
%
setlength{marginparsep}{0mm} %
%
renewcommand{subQuestionNB}{alph{subQuestion}) }

renewcommand{AnswerHeader}{medskip{textbf{AnswerName %
    ExerciseHeaderNB}smallskip}}

renewcommand{ExerciseHeader}{textbf{quad:ExerciseName;ExerciseHeaderNBExerciseHeaderTitleExerciseHeaderOrigin} %
  parnopagebreakmedskip}

setlength{subQuestionIndent}{16.8pt}

renewcounter{Exercise}[chapter] % Reset counter every chapter
renewcounter{Answer}[chapter] %
newcounter{Problem}[chapter] %
%
defAnswerName{par{Answers to questions on chapter}} %
%
begin{document}

begin{Exercise}[label={E1},name={Exercises on chapter},counter={Problem}]
  Question{What is the symbol for iron?}
  Question{What is the symbol for hydrogen?}
end{Exercise}

begin{Exercise}[label={E2},name={Exercises on chapter},counter={Problem}]
  Question{What is the symbol for iron?}
  Question{For hydrogen, state the following:}
        subQuestion{the valency?} subQuestion{the atomic number?} subQuestion{the density?}
end{Exercise}

  begin{Answer}[ref={E1}]
    Question{Fe}     
  Question{H} 
  end{Answer}

  begin{Answer}[ref={E2}]
  Question{Fe}
    Question{}
    subQuestion{2}
    subQuestion{1 - Want this answer to follow on same line as (a)}
    subQuestion{small - and this answer, too}
  end{Answer}

shipoutAnswer

end{document}


Get this bounty!!!

Sort a list of tuples by Nth item in Python

Suppose you have a list of tuples that looks something like this:

[('abc', 121),('abc', 231),('abc', 148), ('abc',221)]

And you want to sort this list in ascending order by the integer value inside the tuples.

We can achieve this using the key keyword with sorted().

sorted([('abc', 121),('abc', 231),('abc', 148), ('abc',221)], key=lambda x: x[1])

key should be a function that identifies how to retrieve the comparable element from your data structure. For example, the second element of the tuple, so we access [1].

Source: StackOverflow.com