Nathan, A workaround would be to do a sprintf in the script and then use the string in the text of the problem.
<script type=“loncapa/perl”> $length = 157; $result = sprintf("%.02E", $length); </script> <startouttext/> The length is $result meters.<endouttext/> It’s a bit cumbersome, but it looks like it works. Mark > On Sep 28, 2022, at 4:07 PM, Moore, Nathan T via LON-CAPA-users > <lon-capa-users@mail.lon-capa.org> wrote: > > Use caution with links and attachments. > Imagine I have a variable that’s random > > $length=&random(150,250,1); > > Specific case, $length = 157; > > I want this value to be printed for users with the “E” power of 10 notation, > eg I want the user to see > > 1.57E2 > > The following code displays almost what I want, 1.57x10^2, but what I really > want is 1.57E2 <num format="%.02E">$length</num> > > Thoughts on a workaround? > > ----------------------------------------------------------------- > Nathan Moore, PhD (he/him) > > Professor, Physics and General Engineering Programs > Winona State University > > Come study on Minnesota’s Southeast Coast > > _______________________________________________ > LON-CAPA-users mailing list > LON-CAPA-users@mail.lon-capa.org > http://mail.lon-capa.org/mailman/listinfo/lon-capa-users -- Mark Lucas Professor of Instruction Department of Physics and Astronomy (College of Arts and Sciences)/Ohio Honors Program (Honors College) 252D Clippinger Lab, Ohio University, Athens, OH 45701 email: luc...@ohio.edu phone: (740)597-2984 Pronouns: He, Him, His _______________________________________________ LON-CAPA-users mailing list LON-CAPA-users@mail.lon-capa.org http://mail.lon-capa.org/mailman/listinfo/lon-capa-users