<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?action=history&amp;feed=atom&amp;title=Example_code_-_Lists</id>
	<title>Example code - Lists - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?action=history&amp;feed=atom&amp;title=Example_code_-_Lists"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_Lists&amp;action=history"/>
	<updated>2026-04-25T00:49:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_Lists&amp;diff=132&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot;== Analysing string content == This is an upgrade of the previous &quot;Determine the input&quot;. Here every word, integer and float on the line is counted. Quite a few list concepts are used - on purpose. &lt;pre&gt; inputstring = input(&quot;Enter something and I will figure out what it is: &quot;) inlist = inputstring.split() # ints, floats and words count resultlist = [0, 0, 0] resultname = (&#039;ints&#039;, &#039;floats&#039;, &#039;words&#039;) # Analyze for item in inlist:     try:         itempos = 2         result...&quot;</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_Lists&amp;diff=132&amp;oldid=prev"/>
		<updated>2025-08-28T21:43:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Analysing string content == This is an upgrade of the previous &amp;quot;Determine the input&amp;quot;. Here every word, integer and float on the line is counted. Quite a few list concepts are used - on purpose. &amp;lt;pre&amp;gt; inputstring = input(&amp;quot;Enter something and I will figure out what it is: &amp;quot;) inlist = inputstring.split() # ints, floats and words count resultlist = [0, 0, 0] resultname = (&amp;#039;ints&amp;#039;, &amp;#039;floats&amp;#039;, &amp;#039;words&amp;#039;) # Analyze for item in inlist:     try:         itempos = 2         result...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Analysing string content ==&lt;br /&gt;
This is an upgrade of the previous &amp;quot;Determine the input&amp;quot;. Here every word, integer and float on the line is counted. Quite a few list concepts are used - on purpose.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inputstring = input(&amp;quot;Enter something and I will figure out what it is: &amp;quot;)&lt;br /&gt;
inlist = inputstring.split()&lt;br /&gt;
# ints, floats and words count&lt;br /&gt;
resultlist = [0, 0, 0]&lt;br /&gt;
resultname = (&amp;#039;ints&amp;#039;, &amp;#039;floats&amp;#039;, &amp;#039;words&amp;#039;)&lt;br /&gt;
# Analyze&lt;br /&gt;
for item in inlist:&lt;br /&gt;
    try:&lt;br /&gt;
        itempos = 2&lt;br /&gt;
        result = float(item)&lt;br /&gt;
        itempos = 1&lt;br /&gt;
        result = int(item)&lt;br /&gt;
        itempos = 0&lt;br /&gt;
    except ValueError:&lt;br /&gt;
        pass&lt;br /&gt;
    resultlist[itempos] += 1&lt;br /&gt;
&lt;br /&gt;
printlist = list()&lt;br /&gt;
&lt;br /&gt;
if inputstring == &amp;quot;&amp;quot;:&lt;br /&gt;
    printlist.append(&amp;quot;No input&amp;quot;)&lt;br /&gt;
elif len(inlist) == 0:&lt;br /&gt;
    printlist.append(&amp;quot;Just some whitespace&amp;quot;)&lt;br /&gt;
else:&lt;br /&gt;
    # Remove non-interesting 0 results - no need to say you found 0 integers.&lt;br /&gt;
    for i in range(len(resultlist)):&lt;br /&gt;
        if resultlist[i] != 0:&lt;br /&gt;
            printlist.append(str(resultlist[i]) + &amp;quot; &amp;quot; + resultname[i])&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;The input had:&amp;quot;, &amp;#039; and &amp;#039;.join(printlist))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>