<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?action=history&amp;feed=atom&amp;title=Beginning_classes</id>
	<title>Beginning classes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?action=history&amp;feed=atom&amp;title=Beginning_classes"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;action=history"/>
	<updated>2026-05-03T06:55:58Z</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/22118/index.php?title=Beginning_classes&amp;diff=262&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises for extra practice */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=262&amp;oldid=prev"/>
		<updated>2026-03-18T09:04:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises for extra practice&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:04, 18 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The Fasta class exercises all have one thing in common, that has not been addressed: The identifiers on the header line in a fasta file HAVE TO BE UNIQUE within the file - that is why they are identifiers. That also goes for the lists of headers/sequences in the Fasta class. The extra work you do here is to make sure this unique property of the identifiers are upheld whenever you add header/sequences to the Fasta object. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;You do not have to check this when &lt;/del&gt;you delete headers/sequences &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;because if they were unique before &lt;/del&gt;the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;deletion, they &lt;/del&gt;will &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;also &lt;/del&gt;be &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;after&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The Fasta class exercises all have one thing in common, that has not been addressed: The identifiers on the header line in a fasta file HAVE TO BE UNIQUE within the file - that is why they are identifiers. That also goes for the lists of headers/sequences in the Fasta class. The extra work you do here is to make sure this unique property of the identifiers are upheld whenever you add header/sequences to the Fasta object. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This is only relevant upon &#039;&#039;&#039;load&#039;&#039;&#039; and &#039;&#039;&#039;insert&#039;&#039;&#039;ion. Observation: When &lt;/ins&gt;you delete &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;unique &lt;/ins&gt;headers/sequences &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;from a Fasta object, &lt;/ins&gt;the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;leftovers &lt;/ins&gt;will &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;still &lt;/ins&gt;be &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;unique&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=261&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises for extra practice */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=261&amp;oldid=prev"/>
		<updated>2026-03-18T09:00:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises for extra practice&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:00, 18 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The Fasta class exercises all have one thing in common, that has not been addressed: The identifiers on the header line in a fasta file HAVE TO BE UNIQUE within the file - that is why they are identifiers. That also goes for the lists of headers/sequences in the Fasta class. The extra work you do here is to make sure this unique property of the identifiers are upheld whenever you add header/sequences to the Fasta object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The Fasta class exercises all have one thing in common, that has not been addressed: The identifiers on the header line in a fasta file HAVE TO BE UNIQUE within the file - that is why they are identifiers. That also goes for the lists of headers/sequences in the Fasta class. The extra work you do here is to make sure this unique property of the identifiers are upheld whenever you add header/sequences to the Fasta object&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. You do not have to check this when you delete headers/sequences because if they were unique before the deletion, they will also be after&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=260&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises for extra practice */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=260&amp;oldid=prev"/>
		<updated>2026-03-18T08:57:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises for extra practice&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:57, 18 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# The Fasta class exercises all have one thing in common, that has not been addressed: The identifiers on the header line in a fasta file HAVE TO BE UNIQUE within the file - that is why they are identifiers. That also goes for the lists of headers/sequences in the Fasta class. The extra work you do here is to make sure this unique property of the identifiers are upheld whenever you add header/sequences to the Fasta object.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=231&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises to be handed in */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=231&amp;oldid=prev"/>
		<updated>2026-03-16T15:05:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises to be handed in&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:05, 16 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l18&quot;&gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The last exercises will be about the making of a fasta file handling class. As the exercises goes on the class can do more and more. The class methods need some decent input control and you need to think about what is required. Notice how versatile the class becomes, as you progress through the exercises.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The last exercises will be about the making of a fasta file handling class. As the exercises goes on the class can do more and more. The class methods need some decent input control and you need to think about what is required. Notice how versatile the class becomes, as you progress through the exercises.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &#039;&#039;&#039;MyMath&#039;&#039;&#039; class, add a method to supply an instance of the class &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;with a list of numbers&lt;/del&gt;. Now make the methods &#039;&#039;&#039;maximum&#039;&#039;&#039;, &#039;&#039;&#039;minimum&#039;&#039;&#039; and &#039;&#039;&#039;average&#039;&#039;&#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&#039;Max is&#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &#039;&#039;&#039;MyMath&#039;&#039;&#039; class, add a method to supply &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a list of numbers to &lt;/ins&gt;an instance of the class. Now make the methods &#039;&#039;&#039;maximum&#039;&#039;&#039;, &#039;&#039;&#039;minimum&#039;&#039;&#039; and &#039;&#039;&#039;average&#039;&#039;&#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&#039;Max is&#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;Fasta&amp;#039;&amp;#039;&amp;#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 methods to the class:&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;load(filename)&amp;#039;&amp;#039;&amp;#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;save(filename)&amp;#039;&amp;#039;&amp;#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&amp;quot;dna7.fsa&amp;quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&amp;quot;newfile.fsa&amp;quot;)&amp;lt;/div&amp;gt; You can consider modifying the &amp;#039;&amp;#039;&amp;#039;__init__&amp;#039;&amp;#039;&amp;#039; so if you supply a filename, it calls the &amp;#039;&amp;#039;&amp;#039;load&amp;#039;&amp;#039;&amp;#039; method automatically.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;Fasta&amp;#039;&amp;#039;&amp;#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 methods to the class:&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;load(filename)&amp;#039;&amp;#039;&amp;#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;save(filename)&amp;#039;&amp;#039;&amp;#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&amp;quot;dna7.fsa&amp;quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&amp;quot;newfile.fsa&amp;quot;)&amp;lt;/div&amp;gt; You can consider modifying the &amp;#039;&amp;#039;&amp;#039;__init__&amp;#039;&amp;#039;&amp;#039; so if you supply a filename, it calls the &amp;#039;&amp;#039;&amp;#039;load&amp;#039;&amp;#039;&amp;#039; method automatically.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=230&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises to be handed in */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=230&amp;oldid=prev"/>
		<updated>2026-03-16T11:23:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises to be handed in&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:23, 16 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &amp;#039;&amp;#039;&amp;#039;maximum&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;minimum&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;average&amp;#039;&amp;#039;&amp;#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&amp;#039;Max is&amp;#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &amp;#039;&amp;#039;&amp;#039;maximum&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;minimum&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;average&amp;#039;&amp;#039;&amp;#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&amp;#039;Max is&amp;#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &#039;&#039;&#039;Fasta&#039;&#039;&#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 methods to the class:&amp;lt;br&amp;gt;&#039;&#039;&#039;load(filename)&#039;&#039;&#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&#039;&#039;&#039;save(filename)&#039;&#039;&#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&#039;&#039;&#039;content()&#039;&#039;&#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&quot;dna7.fsa&quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&quot;newfile.fsa&quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &#039;&#039;&#039;Fasta&#039;&#039;&#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 methods to the class:&amp;lt;br&amp;gt;&#039;&#039;&#039;load(filename)&#039;&#039;&#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&#039;&#039;&#039;save(filename)&#039;&#039;&#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&#039;&#039;&#039;content()&#039;&#039;&#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&quot;dna7.fsa&quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&quot;newfile.fsa&quot;)&amp;lt;/div&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;You can consider modifying the &#039;&#039;&#039;__init__&#039;&#039;&#039; so if you supply a filename, it calls the &#039;&#039;&#039;load&#039;&#039;&#039; method automatically.&lt;/ins&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Modify the &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; method, so it works similar to &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039;. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; it returns 2 lists with all headers and sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;content(start)&amp;#039;&amp;#039;&amp;#039; it returns the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it returns the headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039; as two lists. Be careful that you return a copy of the lists and not the lists themselves as then the headers and sequences in the instance can be modified unintended outside the instance.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Modify the &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; method, so it works similar to &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039;. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; it returns 2 lists with all headers and sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;content(start)&amp;#039;&amp;#039;&amp;#039; it returns the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it returns the headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039; as two lists. Be careful that you return a copy of the lists and not the lists themselves as then the headers and sequences in the instance can be modified unintended outside the instance.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=229&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises to be handed in */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=229&amp;oldid=prev"/>
		<updated>2026-03-16T11:20:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises to be handed in&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:20, 16 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &amp;#039;&amp;#039;&amp;#039;maximum&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;minimum&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;average&amp;#039;&amp;#039;&amp;#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&amp;#039;Max is&amp;#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &amp;#039;&amp;#039;&amp;#039;maximum&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;minimum&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;average&amp;#039;&amp;#039;&amp;#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&amp;#039;Max is&amp;#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &#039;&#039;&#039;Fasta&#039;&#039;&#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 methods &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in &lt;/del&gt;the class:&amp;lt;br&amp;gt;&#039;&#039;&#039;load(filename)&#039;&#039;&#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&#039;&#039;&#039;save(filename)&#039;&#039;&#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&#039;&#039;&#039;content()&#039;&#039;&#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&quot;dna7.fsa&quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&quot;newfile.fsa&quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &#039;&#039;&#039;Fasta&#039;&#039;&#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 methods &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;to &lt;/ins&gt;the class:&amp;lt;br&amp;gt;&#039;&#039;&#039;load(filename)&#039;&#039;&#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&#039;&#039;&#039;save(filename)&#039;&#039;&#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&#039;&#039;&#039;content()&#039;&#039;&#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&quot;dna7.fsa&quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&quot;newfile.fsa&quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Modify the &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; method, so it works similar to &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039;. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; it returns 2 lists with all headers and sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;content(start)&amp;#039;&amp;#039;&amp;#039; it returns the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it returns the headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039; as two lists. Be careful that you return a copy of the lists and not the lists themselves as then the headers and sequences in the instance can be modified unintended outside the instance.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Modify the &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; method, so it works similar to &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039;. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; it returns 2 lists with all headers and sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;content(start)&amp;#039;&amp;#039;&amp;#039; it returns the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it returns the headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039; as two lists. Be careful that you return a copy of the lists and not the lists themselves as then the headers and sequences in the instance can be modified unintended outside the instance.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=228&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises to be handed in */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=228&amp;oldid=prev"/>
		<updated>2026-03-16T11:20:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises to be handed in&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:20, 16 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &amp;#039;&amp;#039;&amp;#039;maximum&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;minimum&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;average&amp;#039;&amp;#039;&amp;#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&amp;#039;Max is&amp;#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &amp;#039;&amp;#039;&amp;#039;maximum&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;minimum&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;average&amp;#039;&amp;#039;&amp;#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&amp;#039;Max is&amp;#039;, mm.maximum())&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &#039;&#039;&#039;Fasta&#039;&#039;&#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 class &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;methods&lt;/del&gt;:&amp;lt;br&amp;gt;&#039;&#039;&#039;load(filename)&#039;&#039;&#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&#039;&#039;&#039;save(filename)&#039;&#039;&#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&#039;&#039;&#039;content()&#039;&#039;&#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&quot;dna7.fsa&quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&quot;newfile.fsa&quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &#039;&#039;&#039;Fasta&#039;&#039;&#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;methods in the &lt;/ins&gt;class:&amp;lt;br&amp;gt;&#039;&#039;&#039;load(filename)&#039;&#039;&#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&#039;&#039;&#039;save(filename)&#039;&#039;&#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&#039;&#039;&#039;content()&#039;&#039;&#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&quot;dna7.fsa&quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&quot;newfile.fsa&quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Modify the &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; method, so it works similar to &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039;. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; it returns 2 lists with all headers and sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;content(start)&amp;#039;&amp;#039;&amp;#039; it returns the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it returns the headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039; as two lists. Be careful that you return a copy of the lists and not the lists themselves as then the headers and sequences in the instance can be modified unintended outside the instance.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Modify the &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; method, so it works similar to &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039;. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039; it returns 2 lists with all headers and sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;content(start)&amp;#039;&amp;#039;&amp;#039; it returns the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it returns the headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039; as two lists. Be careful that you return a copy of the lists and not the lists themselves as then the headers and sequences in the instance can be modified unintended outside the instance.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;insert(header,sequence[,position])&amp;#039;&amp;#039;&amp;#039;, which adds header and sequence to the instance lists. &amp;#039;&amp;#039;header&amp;#039;&amp;#039; and &amp;#039;&amp;#039;sequence&amp;#039;&amp;#039; can either be simple strings (single header and sequence) or lists of headers and sequences. If &amp;#039;&amp;#039;position&amp;#039;&amp;#039; is not given, then the addition takes place at the end of the existing headers/sequences. If &amp;#039;&amp;#039;position&amp;#039;&amp;#039; is given then insertion takes places at that position.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;insert(header,sequence[,position])&amp;#039;&amp;#039;&amp;#039;, which adds header and sequence to the instance lists. &amp;#039;&amp;#039;header&amp;#039;&amp;#039; and &amp;#039;&amp;#039;sequence&amp;#039;&amp;#039; can either be simple strings (single header and sequence) or lists of headers and sequences. If &amp;#039;&amp;#039;position&amp;#039;&amp;#039; is not given, then the addition takes place at the end of the existing headers/sequences. If &amp;#039;&amp;#039;position&amp;#039;&amp;#039; is given then insertion takes places at that position.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &#039;&#039;&#039;verify(alphabet,[start[,end]])&#039;&#039;&#039;, which verifies sequence entries according to an alphabet. It works in a way similar to &#039;&#039;&#039;delete()&#039;&#039;&#039; and &#039;&#039;&#039;content()&#039;&#039;&#039; for the range of what should be verified. The method returns True if all entries in the range are verified (belonging to the alphabet), False otherwise.&amp;lt;br&amp;gt;The alphabet could be a DNA alphabet (ATCG), a protein alphabet or something derived from those. You should put your alphabets into class variables, as they are common for all instances, and not subject to change. Think about generalizing this exercise; You could have short names for your alphabet, you could make methods that could dynamically increase the number of alphabets the class handle. After all, an alphabet is just certain chars that your method has to verify that only those are present in the sequence. You can have any number of alphabets, and the verification method is still the same.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &#039;&#039;&#039;verify(alphabet,[start[,end]])&#039;&#039;&#039;, which verifies sequence entries according to an alphabet. It works in a way similar to &#039;&#039;&#039;delete()&#039;&#039;&#039; and &#039;&#039;&#039;content()&#039;&#039;&#039; for the range of what should be verified. The method returns True if all entries in the range are verified (belonging to the alphabet), False otherwise.&amp;lt;br&amp;gt;The alphabet could be a DNA alphabet (ATCG), a protein alphabet or something derived from those. You should put your alphabets into class variables, as they are common for all instances, and not subject to change. Think about generalizing this exercise; You could have short names for your alphabet, you could make methods that could dynamically increase the number of alphabets the class handle. After all, an alphabet is just certain chars that your method has to verify that only those are present in the sequence. You can have any number of alphabets, and the verification method is still the same&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Try on &#039;&#039;dnanoise.fsa&#039;&#039;&lt;/ins&gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &#039;&#039;&#039;discard(alphabet,[start[,end]])&#039;&#039;&#039;, which discards sequence entries and corresponding headers if they do not match the given alphabet. It works in a way similar to &#039;&#039;&#039;delete()&#039;&#039;&#039; and &#039;&#039;&#039;content()&#039;&#039;&#039; for the range of what should be verified.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &#039;&#039;&#039;discard(alphabet,[start[,end]])&#039;&#039;&#039;, which discards sequence entries and corresponding headers if they do not match the given alphabet. It works in a way similar to &#039;&#039;&#039;delete()&#039;&#039;&#039; and &#039;&#039;&#039;content()&#039;&#039;&#039; for the range of what should be verified&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Try on &#039;&#039;dnanoise.fsa&#039;&#039;&lt;/ins&gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises for extra practice ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=218&amp;oldid=prev</id>
		<title>WikiSysop: /* Subjects covered */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=218&amp;oldid=prev"/>
		<updated>2026-03-12T20:33:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Subjects covered&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:33, 12 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Subjects covered ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Subjects covered ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Classes&lt;/del&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Overview and motivation for classes&lt;/ins&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Object Oriented Programming&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Class structure&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Creating simple classes&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises to be handed in ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exercises to be handed in ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=217&amp;oldid=prev</id>
		<title>WikiSysop: /* Required course material for the lesson */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=217&amp;oldid=prev"/>
		<updated>2026-03-12T20:32:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Required course material for the lesson&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:32, 12 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Required course material for the lesson ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Required course material for the lesson ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Powerpoint: [https://teaching.healthtech.dtu.dk/material/22118/22118_07-Decorators.ppt Decorators]&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Powerpoint: [https://teaching.healthtech.dtu.dk/material/22118/22118_07-Classes.ppt Classes]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Powerpoint: [https://teaching.healthtech.dtu.dk/material/22118/22118_07-Classes.ppt Classes]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Resource: [[Example code - Classes]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Resource: [[Example code - Classes]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=213&amp;oldid=prev</id>
		<title>WikiSysop: /* Exercises to be handed in */</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22118/index.php?title=Beginning_classes&amp;diff=213&amp;oldid=prev"/>
		<updated>2026-03-06T13:49:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises to be handed in&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:49, 6 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l16&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The last exercises will be about the making of a fasta file handling class. As the exercises goes on the class can do more and more. The class methods need some decent input control and you need to think about what is required. Notice how versatile the class becomes, as you progress through the exercises.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The last exercises will be about the making of a fasta file handling class. As the exercises goes on the class can do more and more. The class methods need some decent input control and you need to think about what is required. Notice how versatile the class becomes, as you progress through the exercises.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;MyMath&amp;#039;&amp;#039;&amp;#039;. Add the following methods; &amp;#039;&amp;#039;&amp;#039;cube&amp;#039;&amp;#039;&amp;#039; which raises the input number to the power of 3 and returns it, &amp;#039;&amp;#039;&amp;#039;factorial&amp;#039;&amp;#039;&amp;#039; which computes the factorial of the input integer and returns it, &amp;#039;&amp;#039;&amp;#039;collatz_steps&amp;#039;&amp;#039;&amp;#039; takes a positive integer and repeatedly solves [https://en.wikipedia.org/wiki/Collatz_conjecture Collatz conjecture] until 1 is reached and returns how many steps/iterations of the collatz function it took. It takes 350 steps for the number 77031.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &#039;&#039;&#039;MyMath&#039;&#039;&#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &#039;&#039;&#039;maximum&#039;&#039;&#039;, &#039;&#039;&#039;minimum&#039;&#039;&#039; and &#039;&#039;&#039;average&#039;&#039;&#039; that returns the obvious result from the list.&amp;lt;br&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&#039;Max is&#039;, mm.maximum())&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your &#039;&#039;&#039;MyMath&#039;&#039;&#039; class, add a method to supply an instance of the class with a list of numbers. Now make the methods &#039;&#039;&#039;maximum&#039;&#039;&#039;, &#039;&#039;&#039;minimum&#039;&#039;&#039; and &#039;&#039;&#039;average&#039;&#039;&#039; that returns the obvious result from the list.&amp;lt;br&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt;&amp;lt;div style=&quot;font-family:&#039;Courier New&#039;&quot;&lt;/ins&gt;&amp;gt;mm = MyMath()&amp;lt;br&amp;gt;mm.supply(mylist)&amp;lt;br&amp;gt;print(&#039;Max is&#039;, mm.maximum())&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/ins&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;Fasta&amp;#039;&amp;#039;&amp;#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 class methods:&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;load(filename)&amp;#039;&amp;#039;&amp;#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;save(filename)&amp;#039;&amp;#039;&amp;#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&amp;quot;dna7.fsa&amp;quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&amp;quot;newfile.fsa&amp;quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Create a class called &amp;#039;&amp;#039;&amp;#039;Fasta&amp;#039;&amp;#039;&amp;#039;. The purpose of the class is to do various kinds of manipulation of fasta files and sequences. Start with adding 3 class methods:&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;load(filename)&amp;#039;&amp;#039;&amp;#039;, which gets a file name/path and loads the fasta file into internal instance lists with header and sequence.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;save(filename)&amp;#039;&amp;#039;&amp;#039;, which writes the internal instance header/sequence lists into a fasta file.&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;content()&amp;#039;&amp;#039;&amp;#039;, which returns two lists; the headers and the sequences.&amp;lt;br&amp;gt;You can likely reuse part of your functions in exercise 1 and 2 from [[Functions, namespace, memory_management]].&amp;lt;br&amp;gt;Example use of the Fasta class:&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;font-family:&amp;#039;Courier New&amp;#039;&amp;quot;&amp;gt;myfasta = Fasta()&amp;lt;br&amp;gt;myfasta.load(&amp;quot;dna7.fsa&amp;quot;)&amp;lt;br&amp;gt;print(myfasta.content())&amp;lt;br&amp;gt;myfasta.save(&amp;quot;newfile.fsa&amp;quot;)&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add a method &amp;#039;&amp;#039;&amp;#039;delete([start[,end]])&amp;#039;&amp;#039;&amp;#039;, which deletes entries in the headers and sequences. If called with no arguments like &amp;#039;&amp;#039;&amp;#039;delete()&amp;#039;&amp;#039;&amp;#039; it deletes all headers/sequences. If called with one argument like &amp;#039;&amp;#039;&amp;#039;delete(start)&amp;#039;&amp;#039;&amp;#039; it deletes the header and sequence at position &amp;#039;&amp;#039;start&amp;#039;&amp;#039;. If called with two arguments, it deletes headers and sequences from position &amp;#039;&amp;#039;start&amp;#039;&amp;#039; up to but not including position &amp;#039;&amp;#039;end&amp;#039;&amp;#039;. &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039; can also be negative numbers, and in such case we count from the end of the lists, just like it works in normal list manipulations.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>