# Revision history [back]

### Using timeit in an interact without string formatting

I wanted the following to work, but it didn't. Anyone have an idea how to make it do so?

def T(n):
top = ceil(math.sqrt(n))
print top

@interact
def _(n=6739815371):
T(n)
timeit('T(n)')


def T(n):
top = ceil(math.sqrt(n))
print top

@interact
def _(n=6739815371):
T(n)
timeit('T(%s)'%n)


But I feel like the first thing did indeed work in the past (though I tried it with a Sage from 2010 to no avail).

I guess in some sense this is a silly question - 'T(n)' is a string, pure and simple. At the same time, in the command line

sage: def T(n):
....:         top = ceil(math.sqrt(n))
....:         print top
....:
sage: n=6739815371
sage: timeit('T(n)')
625 loops, best of 3: 5.96 µs per loop


and 'T(n)' is a string there too. So what is different about interact that this doesn't work (in Sage or the cell server)?
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.23906151950359344, "perplexity": 3189.2833367511516}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-51/segments/1575541301014.74/warc/CC-MAIN-20191215015215-20191215043215-00554.warc.gz"}