<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk:443/22101/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=WikiSysop</id>
	<title>22101 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk:443/22101/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=WikiSysop"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php/Special:Contributions/WikiSysop"/>
	<updated>2026-04-07T13:45:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=104</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=104"/>
		<updated>2025-01-31T14:55:19Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Using python elements not in the curriculum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and &amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;you must have done at least 11 evaluations to participate in the exam.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have search the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make the second solution, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=103</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=103"/>
		<updated>2025-01-31T14:51:21Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Reading ahead and using not yet covered techniques in exercises - don&amp;#039;t do it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and &amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;you must have done at least 11 evaluations to participate in the exam.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have search the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you are an advanced python user, and you want to show some fancy python, then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make the second solution, then maybe you should study the subject some more, as you may not be as good as you believe you are.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=102</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=102"/>
		<updated>2025-01-31T14:21:50Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Enforcement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. It has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but upon employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
A simple way for yourself to determine if you have used AI wrong is: &lt;br /&gt;
* Can you explain how your solution works?&lt;br /&gt;
* Do you think &#039;&#039;&#039;I&#039;&#039;&#039; will be happy with the explanation? (a bit subjective)&lt;br /&gt;
* Have functions/methods been used which are not in the curriculum - or later in the curriculum?&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
* Critical thinking&lt;br /&gt;
* Judgement&lt;br /&gt;
* Analysis&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
* Copy/paste behavior&lt;br /&gt;
* Potential for over-reliance - not developing problem-solving skills&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;br /&gt;
* AI is not allowed at exam&lt;br /&gt;
* Exercises made by AI are voided&lt;br /&gt;
How will exercises be recognized as AI generated?&amp;lt;br&amp;gt;&lt;br /&gt;
As AI is trained on &amp;quot;the code available on the internet&amp;quot; almost all AI generated code will contain elements not in the curriculum or not yet gone through in the course progression. Any code that contains these elements is therefore voided.&amp;lt;br&amp;gt;&lt;br /&gt;
This may as a side effect hit advanced students who know more python than expected. If you want to use these elements to show your skill, fine. But do ALSO make a solution without the elements. If you can not do that, maybe you need to study the subject some more and think a bit better.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=101</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=101"/>
		<updated>2025-01-31T14:21:00Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. It has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but upon employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
A simple way for yourself to determine if you have used AI wrong is: &lt;br /&gt;
* Can you explain how your solution works?&lt;br /&gt;
* Do you think &#039;&#039;&#039;I&#039;&#039;&#039; will be happy with the explanation? (a bit subjective)&lt;br /&gt;
* Have functions/methods been used which are not in the curriculum - or later in the curriculum?&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
* Critical thinking&lt;br /&gt;
* Judgement&lt;br /&gt;
* Analysis&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
* Copy/paste behavior&lt;br /&gt;
* Potential for over-reliance - not developing problem-solving skills&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;br /&gt;
* AI is not allowed at exam&lt;br /&gt;
* Exercises made by AI are voided&lt;br /&gt;
How will exercises be recognized as AI generated?&amp;lt;br&amp;gt;&lt;br /&gt;
As AI is trained on &amp;quot;the code available on the internet&amp;quot; almost all AI generated code will contain elements not in the curriculum or not yet gone through in the course progression. Any code that contains these elements are therefore voided.&amp;lt;br&amp;gt;&lt;br /&gt;
This may as a side effect hit advanced students who know more python than expected. If you want to use these elements to show your skill, fine. But do ALSO make a solution without the elements. If you can not do that, maybe you need to study the subject some more and think a bit better.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=100</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=100"/>
		<updated>2025-01-31T12:36:17Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Enforcement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. It has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but upon employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
A simple way for yourself to determine if you have used AI wrong is: &lt;br /&gt;
* Can you explain how your solution works?&lt;br /&gt;
* Do you think &#039;&#039;&#039;I&#039;&#039;&#039; will be happy with the explanation? (a bit subjective)&lt;br /&gt;
* Have functions/methods been used which are not in the curriculum - or later in the curriculum?&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
* Critical thinking&lt;br /&gt;
* Judgement&lt;br /&gt;
* Analysis&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
* Copy/paste behavior&lt;br /&gt;
* Potential for over-reliance - not developing problem-solving skills&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;br /&gt;
* AI is not allowed at exam&lt;br /&gt;
* Exercises made by AI are voided&lt;br /&gt;
How will exercises be recognized as AI generated? If they&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=99</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=99"/>
		<updated>2025-01-31T12:27:57Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. It has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but upon employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
A simple way for yourself to determine if you have used AI wrong is: &lt;br /&gt;
* Can you explain how your solution works?&lt;br /&gt;
* Do you think &#039;&#039;&#039;I&#039;&#039;&#039; will be happy with the explanation? (a bit subjective)&lt;br /&gt;
* Have functions/methods been used which are not in the curriculum - or later in the curriculum?&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
* Critical thinking&lt;br /&gt;
* Judgement&lt;br /&gt;
* Analysis&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
* Copy/paste behavior&lt;br /&gt;
* Potential for over-reliance - not developing problem-solving skills&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;br /&gt;
* AI is not allowed at exam&lt;br /&gt;
* Exercises made by AI are voided&lt;br /&gt;
How will exercises be recognized as AI generated&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=98</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=98"/>
		<updated>2025-01-31T12:06:21Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. It has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but upon employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=97</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=97"/>
		<updated>2025-01-31T12:05:06Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. It has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=96</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=96"/>
		<updated>2025-01-31T11:09:12Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Bad use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=95</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=95"/>
		<updated>2025-01-31T11:04:31Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=94</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=94"/>
		<updated>2025-01-31T10:30:12Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
## Good use ##&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
## Bad use ##&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
## Enforcement ##&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=93</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=93"/>
		<updated>2025-01-31T10:27:30Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=92</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=AI_guidelines_for_the_course&amp;diff=92"/>
		<updated>2025-01-31T10:13:41Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: Created page with &amp;quot;It is strongly preferred that you do &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher. A single example of above:&amp;lt;br&amp;gt; With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning. Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the signif...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=91</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=91"/>
		<updated>2025-01-31T10:02:50Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Competences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=90</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=90"/>
		<updated>2025-01-31T10:01:29Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Course details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=89</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=89"/>
		<updated>2025-01-31T09:47:23Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Peer evaluation of exercises */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and &amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;you must have done at least 11 evaluations to participate in the exam.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading ahead and using not yet covered techniques in exercises - don&#039;t do it ==&lt;br /&gt;
Sometimes people read ahead in the text book or the net and discover some techniques, that makes solving the exercises much easier. You might have learned some python in other courses. While you should learn whatever you can, then there is a reason for why the exercises are as they are, and the learning material (powerpoint) is as it is. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
If you just use an advanced trick, then you are not learning to analyze or formulate strategies. You are simply not learning to work with what you have, and consequently you will be doing enormous harm to your future learning. &lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&lt;br /&gt;
Python is full of tricks, so it is rather tempting, but damaging to use them during the course. You will have plenty of opportunity later to do trick programming.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=88</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=88"/>
		<updated>2025-01-31T09:45:04Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and you must have done at least 11 evaluations to participate in the exam.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do.&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading ahead and using not yet covered techniques in exercises - don&#039;t do it ==&lt;br /&gt;
Sometimes people read ahead in the text book or the net and discover some techniques, that makes solving the exercises much easier. You might have learned some python in other courses. While you should learn whatever you can, then there is a reason for why the exercises are as they are, and the learning material (powerpoint) is as it is. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
If you just use an advanced trick, then you are not learning to analyze or formulate strategies. You are simply not learning to work with what you have, and consequently you will be doing enormous harm to your future learning. &lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&lt;br /&gt;
Python is full of tricks, so it is rather tempting, but damaging to use them during the course. You will have plenty of opportunity later to do trick programming.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Dictionaries&amp;diff=87</id>
		<title>Dictionaries</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Dictionaries&amp;diff=87"/>
		<updated>2024-11-26T08:08:37Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Sets]]&lt;br /&gt;
|Next: [[How to Python]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_13-Dicts.ppt Dictionaries]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=61d288cc-5f62-4027-a83e-af27012c27d2 Dictionaries]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=7b897492-bedb-4042-a4fc-af27012c0a0b Tips and Tricks]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] Every time you read it, you will take something from it.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Dicts]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=276ecfa4-012e-47b4-b521-af27012b06d9 Live Coding]&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Dictionaries, which are unordered tables of data.&lt;br /&gt;
* Functions relevant to dictionaries:&lt;br /&gt;
** &#039;&#039;&#039;keys&#039;&#039;&#039;, returns a list of keys in the dictionary,&lt;br /&gt;
** &#039;&#039;&#039;values&#039;&#039;&#039;, returns a list of values in the dictionary,&lt;br /&gt;
** &#039;&#039;&#039;in&#039;&#039;&#039;, determines if a key/value pair exist,&lt;br /&gt;
** &#039;&#039;&#039;del&#039;&#039;&#039;, which deletes a key/value pair,&lt;br /&gt;
** &#039;&#039;&#039;items&#039;&#039;&#039;, which iterates over all key/value pair in the dictionary.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Create a dictionary where the keys are codons and the value are the one-letter-code for the amino acids. The dictionary will function as a look-up table. You can find a [[codon list]] here. You are meant to make the dict &amp;quot;by hand&amp;quot; as there is a structure lesson in that. If you feel like it you can in addition make a program that constructs the dict from a file.&lt;br /&gt;
# Use the dictionary from the previous exercise in a program, that translates all the nucleotide fasta entries in &#039;&#039;dna7.fsa&#039;&#039; to amino acid sequence. Save the results in a file &#039;&#039;aa7.fsa&#039;&#039; in fasta format. Since the sequence is now consisting of amino acids add &#039;Amino Acid Sequence&#039; to each header. The STOP codon is NOT a part of the amino acid sequence. Think about what STOP means.&lt;br /&gt;
# In the file &#039;&#039;ex5.acc&#039;&#039; are a lot of accession numbers, where some are duplicates. Earlier we just removed the duplicates, now we should count them. Make a program that reads the file once, and writes a file &#039;&#039;noorder5.acc&#039;&#039; with the unique accession numbers and the number of occurrences in the file. A line should look like this: &amp;quot;AC24677 2&amp;quot;, if this accession occurs twice in &#039;&#039;ex5.acc&#039;&#039;.&lt;br /&gt;
# Improve the previous exercise by saving the accessions in order of occurrences with the top counts first in the file &#039;&#039;order5.acc&#039;&#039;.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;In the tab-separated files &#039;&#039;slinger.txt&#039;&#039; and &#039;&#039;hoist.txt&#039;&#039; are two columns with an accession number and a numeric result; a probability between 0 and 1. The numbers are from running 2 different programs (slinger and hoist, if you are in doubt). You must combine these probabilities - basically taking the average of the two numbers - for each accession number and write the result in a file &#039;&#039;combined.txt&#039;&#039;. The file should look like the sources, i.e. tab-separated with accession in column 1 and number in column 2. Unfortunately, the two programs have not been run from the same set of accession numbers, so some of the results are only available in one of the input files. In such case you ignore/discard the data for that accession. Only save results in the output file when the accession is in both of the input files.&amp;lt;/font&amp;gt;&lt;br /&gt;
# Using above method gives you too little data. You try this time to combine your two input sets differently. If an accession is in both input files you use the average, if it is in only one, you just use the number straight in the output file. This is effectively making a union of the input instead of an intersection.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Given a tab-separated file with 3 columns; StudentID, CourseNumber, Grade. Can you find a way to load the grades for a student in a retrievable manner into (some of) the python data structures learned so far? Retrievable means here that you can find the grades for a student if you know the studentID.&amp;lt;br&amp;gt;Explain your approach. Hint: It is not necessarily efficient.&lt;br /&gt;
* The &#039;&#039;geneA-E.txt&#039;&#039; files all have the same structure on each line; first number is a float between 0 and 1, second number is an integer. For all files (the combined data set) find the average of the float, given the integer and display in ascending order of the integer. You need to add all the floats for a given integer together and divide by the number of floats for the integer, then you have the average for the integer. To succeed at this, you must use two dicts where the integer is the key in both. The corresponding values are the sum of the floats (for that key) and the number of times the key has been encountered in the files.&lt;br /&gt;
* This exercise requires that you did the last two practice exercises in [[Simple Pattern Matching]]. In the &#039;&#039;data1-4.gb&#039;&#039; files count who many times the different codons in the coding sequence occurs. Display.&lt;br /&gt;
* This exercise builds on mandatory exercise 2. You must read the &#039;&#039;dna7.fsa&#039;&#039; file and translate the DNA sequences to protein sequence. Report the frequencies of the various amino acids for the entire file - all sequences (not individual sequences). That is - count how many there is of each amino acid (a total) in the translated sequences, compute the frequency of each (Number_of_this_amino_acid/Total_number_of_amino_acids) and print the results as &amp;quot;S   0.0123&amp;quot;, i.e. 4 digits after the dot.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=86</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=86"/>
		<updated>2024-11-19T09:46:26Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Preparation for exam */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and you must have done at least 11 evaluations to participate in the exam.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do.&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading ahead and using not yet covered techniques in exercises - don&#039;t do it ==&lt;br /&gt;
Sometimes people read ahead in the text book or the net and discover some techniques, that makes solving the exercises much easier. You might have learned some python in other courses. While you should learn whatever you can, then there is a reason for why the exercises are as they are, and the learning material (powerpoint) is as it is. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
If you just use an advanced trick, then you are not learning to analyze or formulate strategies. You are simply not learning to work with what you have, and consequently you will be doing enormous harm to your future learning. &lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&lt;br /&gt;
Python is full of tricks, so it is rather tempting, but damaging to use them during the course. You will have plenty of opportunity later to do trick programming.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Programme&amp;diff=85</id>
		<title>Programme</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Programme&amp;diff=85"/>
		<updated>2024-11-19T09:43:48Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 03/09 Lesson 1: [[Using Jupyter Notebook]]&lt;br /&gt;
* 10/09 Lesson 2: [[Python Basics]]&lt;br /&gt;
* 17/09 Lesson 3: [[Simple File Reading]]&lt;br /&gt;
* 24/09 Lesson 4: [[Pseudocode and Comments]]&lt;br /&gt;
* 01/10 Lesson 5: [[Python Input-Output]]&lt;br /&gt;
* 08/10 Lesson 6: [[Exceptions and Bug Handling]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 22/10 Lesson 7 [[Stateful Parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 29/10 Lesson 8: [[Lists/Sequences]]&lt;br /&gt;
* 05/11 Lesson 9: [[More with Lists]]&lt;br /&gt;
* 12/11 Lesson 10: [[Simple Pattern Matching]] &lt;br /&gt;
* 19/11 Lesson 11: [[Sets]]&lt;br /&gt;
* 26/11 Lesson 12: [[Dictionaries]]&lt;br /&gt;
* 03/12 Lesson 13: [[How to Python]] - The mistakes we see&lt;br /&gt;
* 12/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan]&lt;br /&gt;
&lt;br /&gt;
== Curious about the exam ==&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22101/index.php/How_the_course_is_conducted#Preparation_for_exam Read this]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Programme&amp;diff=84</id>
		<title>Programme</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Programme&amp;diff=84"/>
		<updated>2024-11-19T09:43:12Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 03/09 Lesson 1: [[Using Jupyter Notebook]]&lt;br /&gt;
* 10/09 Lesson 2: [[Python Basics]]&lt;br /&gt;
* 17/09 Lesson 3: [[Simple File Reading]]&lt;br /&gt;
* 24/09 Lesson 4: [[Pseudocode and Comments]]&lt;br /&gt;
* 01/10 Lesson 5: [[Python Input-Output]]&lt;br /&gt;
* 08/10 Lesson 6: [[Exceptions and Bug Handling]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 22/10 Lesson 7 [[Stateful Parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 29/10 Lesson 8: [[Lists/Sequences]]&lt;br /&gt;
* 05/11 Lesson 9: [[More with Lists]]&lt;br /&gt;
* 12/11 Lesson 10: [[Simple Pattern Matching]] &lt;br /&gt;
* 19/11 Lesson 11: [[Sets]]&lt;br /&gt;
* 26/11 Lesson 12: [[Dictionaries]]&lt;br /&gt;
* 03/12 Lesson 13: [[How to Python]] - The mistakes we see&lt;br /&gt;
* 12/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan]&lt;br /&gt;
&lt;br /&gt;
== Curious about the exam ==&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22101/index.php/How_the_course_is_conducted#Preparation_for_the_exam Read this]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Codon_list&amp;diff=83</id>
		<title>Codon list</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Codon_list&amp;diff=83"/>
		<updated>2024-11-14T20:42:32Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: Created page with &amp;quot;20 Amino acids, their single-letter data-base codes (SLC), and their corresponding DNA codons {| class=&amp;quot;wikitable&amp;quot; |+ !Amino Acid !SLC !DNA codons |- |Isoleucine |I |ATT, ATC, ATA |- |Leucine |L |CTT, CTC, CTA, CTG, TTA, TTG |- |Valine |V |GTT, GTC, GTA, GTG |- |Phenylalanine |F |TTT, TTC |- |Methionine |M |ATG |- |Cysteine |C |TGT, TGC |- |Alanine |A |GCT, GCC, GCA, GCG |- |Glycine |G |GGT, GGC, GGA, GGG |- |Proline |P |CCT, CCC, CCA, CCG |- |Threonine |T |ACT, ACC, ACA...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;20 Amino acids, their single-letter data-base codes (SLC), and their corresponding DNA codons&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Amino Acid&lt;br /&gt;
!SLC&lt;br /&gt;
!DNA codons&lt;br /&gt;
|-&lt;br /&gt;
|Isoleucine&lt;br /&gt;
|I&lt;br /&gt;
|ATT, ATC, ATA&lt;br /&gt;
|-&lt;br /&gt;
|Leucine&lt;br /&gt;
|L&lt;br /&gt;
|CTT, CTC, CTA, CTG, TTA, TTG&lt;br /&gt;
|-&lt;br /&gt;
|Valine&lt;br /&gt;
|V&lt;br /&gt;
|GTT, GTC, GTA, GTG&lt;br /&gt;
|-&lt;br /&gt;
|Phenylalanine&lt;br /&gt;
|F&lt;br /&gt;
|TTT, TTC&lt;br /&gt;
|-&lt;br /&gt;
|Methionine&lt;br /&gt;
|M&lt;br /&gt;
|ATG&lt;br /&gt;
|-&lt;br /&gt;
|Cysteine&lt;br /&gt;
|C&lt;br /&gt;
|TGT, TGC&lt;br /&gt;
|-&lt;br /&gt;
|Alanine&lt;br /&gt;
|A&lt;br /&gt;
|GCT, GCC, GCA, GCG&lt;br /&gt;
|-&lt;br /&gt;
|Glycine&lt;br /&gt;
|G&lt;br /&gt;
|GGT, GGC, GGA, GGG&lt;br /&gt;
|-&lt;br /&gt;
|Proline&lt;br /&gt;
|P&lt;br /&gt;
|CCT, CCC, CCA, CCG&lt;br /&gt;
|-&lt;br /&gt;
|Threonine&lt;br /&gt;
|T&lt;br /&gt;
|ACT, ACC, ACA, ACG&lt;br /&gt;
|-&lt;br /&gt;
|Serine&lt;br /&gt;
|S&lt;br /&gt;
|TCT, TCC, TCA, TCG, AGT, AGC&lt;br /&gt;
|-&lt;br /&gt;
|Tyrosine&lt;br /&gt;
|Y&lt;br /&gt;
|TAT, TAC&lt;br /&gt;
|-&lt;br /&gt;
|Tryptophan&lt;br /&gt;
|W&lt;br /&gt;
|TGG&lt;br /&gt;
|-&lt;br /&gt;
|Glutamine&lt;br /&gt;
|Q&lt;br /&gt;
|CAA, CAG&lt;br /&gt;
|-&lt;br /&gt;
|Asparagine&lt;br /&gt;
|N&lt;br /&gt;
|AAT, AAC&lt;br /&gt;
|-&lt;br /&gt;
|Histidine&lt;br /&gt;
|H&lt;br /&gt;
|CAT, CAC&lt;br /&gt;
|-&lt;br /&gt;
|Glutamic acid&lt;br /&gt;
|E&lt;br /&gt;
|GAA, GAG&lt;br /&gt;
|-&lt;br /&gt;
|Aspartic acid&lt;br /&gt;
|D&lt;br /&gt;
|GAT, GAC&lt;br /&gt;
|-&lt;br /&gt;
|Lysine&lt;br /&gt;
|K&lt;br /&gt;
|AAA, AAG&lt;br /&gt;
|-&lt;br /&gt;
|Arginine&lt;br /&gt;
|R&lt;br /&gt;
|CGT, CGC, CGA, CGG, AGA, AGG&lt;br /&gt;
|-&lt;br /&gt;
|Stop codons&lt;br /&gt;
|Stop&lt;br /&gt;
|TAA, TAG, TGA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In this table, the twenty amino acids found in proteins are listed, along with the single-letter code used to represent these amino acids in protein data bases. The DNA codons representing each amino acid are also listed. All 64 possible 3-letter combinations of the DNA coding units T, C, A and G are used either to encode one of these amino acids or as one of the three stop codons that signals the end of a sequence. While DNA can be decoded unambiguously, it is not possible to predict a DNA sequence from its protein sequence. Because most amino acids have multiple codons, a number of possible DNA sequences might represent the same protein sequence.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=82</id>
		<title>Lists/Sequences</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=82"/>
		<updated>2024-11-06T05:40:07Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Stateful Parsing]]&lt;br /&gt;
|Next: [[More with Lists]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_09-Lists.ppt Lists and Sequences]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=871af158-9477-47c6-8e89-af27012d6e8d The basics of lists in python]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e3b143a8-962c-40ee-bd10-af27012d502c Working with lists, modification]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Lists and sequences.&amp;lt;br&amp;gt;&lt;br /&gt;
Lists methods for list manipulation;&amp;lt;br&amp;gt;&lt;br /&gt;
* changing an element&lt;br /&gt;
* adding/removing an element&lt;br /&gt;
* adding/removing more elements&lt;br /&gt;
* adding/removing elements at specific places&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Make a program that ask for words - one at a time - and saves them in a list (one word per element) until you write STOP. When STOP is entered, write the words in entered order in a file called &#039;&#039;words.txt&#039;&#039;.&lt;br /&gt;
# Searching for accession numbers. In the file &#039;&#039;ex5.acc&#039;&#039; there are 6461 unique GenBank accession numbers (taken from HU6800 DNA array chip). An inexperienced bioinformatician unfortunately fouled up the list, so many of the accession numbers appears more than once. Make a program that first reads the file into a list, then ask for an accession number and counts how many times it appears in the list and displays the result.&lt;br /&gt;
# Different search for accession numbers. This program is similar to the above. First read the file into a list, then continue to ask for accession numbers and check if they are in the list (yes/no, not a count). Keep searching for accession numbers until STOP is entered. Hint: this is 2 loops inside one another.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;You need to clean up the &#039;&#039;ex5.acc&#039;&#039; file. The first step is to sort the accession numbers alphabetically. You must program a sorting algorithm. There are many different algorithms for sorting, but let&#039;s pick a simple one - Bubble Sort.&amp;lt;br&amp;gt;It goes like this. Read the accessions into a list like the previous exercises. Go through the list looking at pairs of accessions (at position i &amp;amp; i+1). If a pair is in the wrong order, you switch them. Repeat going through the list until you have gone through the entire list without switching once. Now the list is sorted and you save the list in the &#039;&#039;sorted5.acc&#039;&#039; file.&amp;lt;br&amp;gt;Note: &#039;&#039;&#039;It takes 10-30 sec to run this program&#039;&#039;&#039;. There is room for optimization in the described algorithm and it is in any case not the most efficient method. You are free to implement a different method. Strings can be compared directly with each other using the operators &amp;lt;nowiki&amp;gt;==, !=, &amp;gt;, &amp;lt;, &amp;gt;=, &amp;lt;=.&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
# It is now time to find the unique accession numbers, so you only have one of each - no duplicates. Read the accessions from &#039;&#039;sorted5.acc&#039;&#039; into a list. Since the list is now sorted, the duplicates are &amp;quot;next&amp;quot; to each other, which makes them easy to find. Make a &#039;&#039;&#039;new&#039;&#039;&#039; list with the unique accessions from the old list, and save that list in the file &#039;&#039;clean5.acc&#039;&#039;. Check that you have 6461 accessions, one per line.&lt;br /&gt;
# In this exercise you have to do the same and achieve the same result in a different way as the previous exercise. Instead of making a new list with the unique accessions, just keep the old list and remove the duplicates. You can use &#039;&#039;&#039;del&#039;&#039;&#039; or &#039;&#039;&#039;pop&#039;&#039;&#039; to remove elements. If you run into trouble imagine your code executed on this list: [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Read two files with numbers into two lists. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this. Now add the numbers together, like the first number in the first file with the first number in the second file, and so forth, i.e. add the column in the file row-wise. You could also consider the numbers in a file to be a vector, and then you add two vectors together. Save the output (a list of numbers, one number per line) in a new file - you decide the name.&lt;br /&gt;
* Continuing previous exercise: Corrupt your input files a bit, change some numbers to not-numbers, like words or empty lines. Make your program work on these files too, assuming anything you can not read is ignored - consider any line you can not convert to a number as containing a zero.&lt;br /&gt;
* Continuing previous exercise: Make the program work even if the input files do not have the same length, just assume zero for the missing lines in the short file. BTW, you do not know which input is short.&lt;br /&gt;
* Read a file with numbers into two lists. The first number in the file goes to the first list, the second number to the second list, the third number to the first list, and so forth - alternating numbers to alternating lists. Compute the sum of the two lists and display. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;br /&gt;
* Now compute the same sums - without the lists :-)&lt;br /&gt;
* Ask for files names and read the numbers in the file into a list. Continue to ask for file names and add the numbers to the list until you enter STOP. Your list of numbers will simply grow with each file you add. Now compute the sum of the numbers in the list and display the result. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=81</id>
		<title>Lists/Sequences</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=81"/>
		<updated>2024-11-06T05:39:52Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Stateful Parsing]]&lt;br /&gt;
|Next: [[More with Lists]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_09-Lists.ppt Lists and Sequences]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=871af158-9477-47c6-8e89-af27012d6e8d The basics of lists in python]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e3b143a8-962c-40ee-bd10-af27012d502c Working with lists, modification]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Lists and sequences.&amp;lt;br&amp;gt;&lt;br /&gt;
Lists methods for list manipulation;&amp;lt;br&amp;gt;&lt;br /&gt;
* changing an element&lt;br /&gt;
* adding/removing an element&lt;br /&gt;
* adding/removing more elements&lt;br /&gt;
* adding/removing elements at specific places&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Make a program that ask for words - one at a time - and saves them in a list (one word per element) until you write STOP. When STOP is entered, write the words in entered order in a file called &#039;&#039;words.txt&#039;&#039;.&lt;br /&gt;
# Searching for accession numbers. In the file &#039;&#039;ex5.acc&#039;&#039; there are 6461 unique GenBank accession numbers (taken from HU6800 DNA array chip). An inexperienced bioinformatician unfortunately fouled up the list, so many of the accession numbers appears more than once. Make a program that first reads the file into a list, then ask for an accession number and counts how many times it appears in the list and displays the result.&lt;br /&gt;
# Different search for accession numbers. This program is similar to the above. First read the file into a list, then continue to ask for accession numbers and check if they are in the list (yes/no, not a count). Keep searching for accession numbers until STOP is entered. Hint: this is 2 loops inside one another.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;You need to clean up the &#039;&#039;ex5.acc&#039;&#039; file. The first step is to sort the accession numbers alphabetically. You must program a sorting algorithm. There are many different algorithms for sorting, but let&#039;s pick a simple one - Bubble Sort.&amp;lt;br&amp;gt;It goes like this. Read the accessions into a list like the previous exercises. Go through the list looking at pairs of accessions (at position i &amp;amp; i+1). If a pair is in the wrong order, you switch them. Repeat going through the list until you have gone through the entire list without switching once. Now the list is sorted and you save the list in the &#039;&#039;sorted5.acc&#039;&#039; file.&amp;lt;br&amp;gt;Note: &#039;&#039;&#039;It takes 10-30 sec to run this program&#039;&#039;&#039;. There is room for optimization in the described algorithm and it is in any case not the most efficient method. You are free to implement a different method. String can be compared directly with each other using the operators &amp;lt;nowiki&amp;gt;==, !=, &amp;gt;, &amp;lt;, &amp;gt;=, &amp;lt;=.&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
# It is now time to find the unique accession numbers, so you only have one of each - no duplicates. Read the accessions from &#039;&#039;sorted5.acc&#039;&#039; into a list. Since the list is now sorted, the duplicates are &amp;quot;next&amp;quot; to each other, which makes them easy to find. Make a &#039;&#039;&#039;new&#039;&#039;&#039; list with the unique accessions from the old list, and save that list in the file &#039;&#039;clean5.acc&#039;&#039;. Check that you have 6461 accessions, one per line.&lt;br /&gt;
# In this exercise you have to do the same and achieve the same result in a different way as the previous exercise. Instead of making a new list with the unique accessions, just keep the old list and remove the duplicates. You can use &#039;&#039;&#039;del&#039;&#039;&#039; or &#039;&#039;&#039;pop&#039;&#039;&#039; to remove elements. If you run into trouble imagine your code executed on this list: [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Read two files with numbers into two lists. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this. Now add the numbers together, like the first number in the first file with the first number in the second file, and so forth, i.e. add the column in the file row-wise. You could also consider the numbers in a file to be a vector, and then you add two vectors together. Save the output (a list of numbers, one number per line) in a new file - you decide the name.&lt;br /&gt;
* Continuing previous exercise: Corrupt your input files a bit, change some numbers to not-numbers, like words or empty lines. Make your program work on these files too, assuming anything you can not read is ignored - consider any line you can not convert to a number as containing a zero.&lt;br /&gt;
* Continuing previous exercise: Make the program work even if the input files do not have the same length, just assume zero for the missing lines in the short file. BTW, you do not know which input is short.&lt;br /&gt;
* Read a file with numbers into two lists. The first number in the file goes to the first list, the second number to the second list, the third number to the first list, and so forth - alternating numbers to alternating lists. Compute the sum of the two lists and display. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;br /&gt;
* Now compute the same sums - without the lists :-)&lt;br /&gt;
* Ask for files names and read the numbers in the file into a list. Continue to ask for file names and add the numbers to the list until you enter STOP. Your list of numbers will simply grow with each file you add. Now compute the sum of the numbers in the list and display the result. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=More_with_Lists&amp;diff=80</id>
		<title>More with Lists</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=More_with_Lists&amp;diff=80"/>
		<updated>2024-10-30T10:02:45Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Lists/Sequences]]&lt;br /&gt;
|Next: [[Simple Pattern Matching]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_10-MoreLists.ppt More with Lists]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=b253adf9-282f-4885-9ce3-af27012d346e More advanced methods with lists]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=9ed4e00e-ed19-4511-af51-af27012d11e5 Miscellaneous list concepts and workings]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Lists]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=0d134a6c-ec9b-46d0-8a62-af27012bf0ef Live Coding]&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Lists and sequences and some methods that operate on lists;&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;sort&#039;&#039;&#039;, which surprisingly sorts the list according to some principle,&lt;br /&gt;
* &#039;&#039;&#039;reverse&#039;&#039;&#039;, which reverses a list,&lt;br /&gt;
* &#039;&#039;&#039;split&#039;&#039;&#039;, which splits a sting into a list.&lt;br /&gt;
* &#039;&#039;&#039;join&#039;&#039;&#039;, which concatenates a list into a string.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Similar to the first exercise last week, make a program that takes the words you input and saves them in the &#039;&#039;words.txt&#039;&#039; file. The difference is that this time there may be several words on the input line, not just one. The output is still one word per output line.&lt;br /&gt;
# Make a program that reads all the words in the file &#039;&#039;words.txt&#039;&#039; into an list. First the words must be sorted alphabetically, then the list should be reversed (the first word shall be the last and vice versa), finally the resulting list should be written in &#039;&#039;words.txt&#039;&#039; - one word per line - the file is being overwritten.&lt;br /&gt;
# After having looked at the cleaned accession numbers in &#039;&#039;clean5.acc&#039;&#039;, you will have seen that the accession numbers are sorted. This means that you can use the much more powerful binary search method when searching for accession numbers. Repeat exercise 3 from last week, but this time use binary search instead of the linear search you did then. See what Wikipedia has to say about [http://en.wikipedia.org/wiki/Binary_search binary search]. Binary search as a method is well described in the solution to the &amp;quot;guess a number&amp;quot; exercise.&lt;br /&gt;
# Calculate the three sums of the three columns in one reading of the file &#039;&#039;ex1.dat&#039;&#039; using &#039;&#039;&#039;split&#039;&#039;&#039; to separate the columns. The sums of the three columns are: -904.4143, 482.8410, 292.0515&lt;br /&gt;
# Improve on the previous exercise by making a program that calculates the sum of all columns in the file, no matter how many columns there are. Each column should be summed individually. You can assume that each row (line) has the same number of columns in the file.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;Make a Python program that can select specific columns from a column based (tab separated) file and save them in a new file. It should select the columns that you specify in the order you specify. Ask for input and output file names and column numbers (3 questions, example &amp;quot;ex1.dat&amp;quot;, &amp;quot;2col.acc&amp;quot; &amp;amp; &amp;quot;3 1&amp;quot;). The program should work with any number of columns in the input file.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
You will program a [https://en.wikipedia.org/wiki/Reverse_Polish_notation reverse polish notation] calculator. This is somewhat complicated, so I will split up the job in a number of smaller exercises, where the one exercise builds on the previous. Shortly, reverse polish notation is a mathematical notation in which operators follow their operands, i.e. adding two numbers is written by &amp;quot;3 4 +&amp;quot; instead of &amp;quot;3 + 4&amp;quot;. We will utilize a [https://en.wikipedia.org/wiki/Stack_(abstract_data_type) stack], which is simply a list, where elements are added to and removed from the bottom.&lt;br /&gt;
* Let&#039;s start with making the overall structure; a loop that asks for input, which is one item/command at a time. Inside the loop, there can be a number of operations depending on the input. If you enter a number, it should be simply appended to your list (the stack, which is the word I will use in the rest of the exercises here). If you enter commands &#039;&#039;&#039;STOP&#039;&#039;&#039;, &#039;&#039;&#039;EXIT&#039;&#039;&#039; or &#039;&#039;&#039;QUIT&#039;&#039;&#039;, the loop should end and the program stop. If you enter something that the program does not understand it should write &amp;quot;Illegal command&amp;quot;, but otherwise do nothing.&lt;br /&gt;
* Add the following commands: &#039;&#039;&#039;PEEK&#039;&#039;&#039;, which displays the last number in the stack, and &#039;&#039;&#039;SHOW&#039;&#039;&#039; which will display the entire stack.&lt;br /&gt;
* Add the standard math operations, &#039;&#039;&#039;+&#039;&#039;&#039;, &#039;&#039;&#039;-&#039;&#039;&#039;, &#039;&#039;&#039;*&#039;&#039;&#039; and &#039;&#039;&#039;/&#039;&#039;&#039;: These remove 2 numbers from the stack (the last number in stack is the first operand and the second last number is the second operand), perform the operation and appends the result back to the stack. You notice operand order matters for - and /. At this point we have a simple but functional calculator.&lt;br /&gt;
* Add single number operations &#039;&#039;&#039;LOG&#039;&#039;&#039; and &#039;&#039;&#039;SQRT&#039;&#039;&#039;, which replaces the last number in the stack with the log/square root of the number.&lt;br /&gt;
* Solidify your program by ensuring any operations first check if the required number of operands are on the stack before trying to perform the operation. Display &amp;quot;Not enough operands on the stack&amp;quot; and otherwise do nothing if the check fails. Hint: Maybe lists of zero, one and two operands commands could be useful.&lt;br /&gt;
* Add the commands: &#039;&#039;&#039;DROP&#039;&#039;&#039; which simply removes the last number on the stack, &#039;&#039;&#039;=&#039;&#039;&#039;, which removes the last number on the stack and displays it, &#039;&#039;&#039;SWITCH&#039;&#039;&#039;, which switches the last two numbers on the stack, and &#039;&#039;&#039;DUP&#039;&#039;&#039; which duplicates the last number on the stack, i.e stack consists of 1, after DUP it consists of 1 1.&lt;br /&gt;
* Add the commands: &#039;&#039;&#039;ABS&#039;&#039;&#039;, &#039;&#039;&#039;NEG&#039;&#039;&#039; which replaces the last number on the stack which the absolute/negative value of the number.&lt;br /&gt;
* At this point you can probably work out some mathematical operations to add that require one or 2 operands by yourself. I can think of the &#039;&#039;&#039;SIN&#039;&#039;&#039;, &#039;&#039;&#039;COS&#039;&#039;&#039; &amp;amp; &#039;&#039;&#039;TAN&#039;&#039;&#039; operations, the &#039;&#039;&#039;INT&#039;&#039;&#039; taking the integer part of a number, &#039;&#039;&#039;EXP&#039;&#039;&#039;onential and &#039;&#039;&#039;SQUARE&#039;&#039;&#039;. Modulo operation with &#039;&#039;&#039;%&#039;&#039;&#039;. &#039;&#039;&#039;FAC&#039;&#039;&#039;torial. You could add constants like &#039;&#039;&#039;PI&#039;&#039;&#039; and &#039;&#039;&#039;E&#039;&#039;&#039; that simply puts an appropriate value on the stack.&lt;br /&gt;
* Add stack control with &#039;&#039;&#039;CLEAR&#039;&#039;&#039; to empty the stack and extend the &#039;&#039;&#039;SWITCH&#039;&#039;&#039; to switch the numbers as two given position like &amp;quot;SWITCH 2 4&amp;quot; if given positions.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Stateful_Parsing&amp;diff=79</id>
		<title>Stateful Parsing</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Stateful_Parsing&amp;diff=79"/>
		<updated>2024-10-30T09:21:04Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises for extra practice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Exceptions and Bug Handling]]&lt;br /&gt;
|Next: [[Lists/Sequences]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_08-StatefulParsing.ppt Stateful Parsing]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=fe50507e-9009-49b1-a3a8-af27012d8cdf Stateful Parsing]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=ce785005-14cd-424a-a406-af27012b3e1b Finding errors with Stateful Parsing]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=acd48c9a-cacb-4832-9184-af27012c7021 Live coding]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Using stateful parsing to extract data spanning several lines, by recognizing keywords.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
The following 5 exercises deal with SwissProt. The file sprot1.dat is a SwissProt database entry. Study it carefully. Locate the SwissProt ID (SP96_DICDI), the accession number (P14328) and the amino acid sequence (MRVLLVLVAC....TTTATTTATS). There are other entries ( &#039;&#039;sprot2.dat&#039;&#039;, &#039;&#039;sprot3.dat&#039;&#039;, &#039;&#039;sprot4.dat&#039;&#039;). Your programs should work on those, too. Also your programs must solve all the problems in ONE reading of the file. It is acceptable if you just hand in one program that solves 1 to 4. 5 is separate. These exercises are about studying and understanding the file format.&lt;br /&gt;
# Make a program that reads the ID and prints it.&lt;br /&gt;
# Add the following functionality to the program: Read the accession number and print it.&lt;br /&gt;
# Add the following functionality to the program: Read the amino acid sequence and print it. You really should use Stateful Parsing in this exercise. Maybe check the video.&lt;br /&gt;
# Add the following functionality to the program: Verification of amino acid number. This means extract the number from the SQ line (example: SQ SEQUENCE 629 AA;) and check that the amino acid sequence has that number of residues. It should be the program that determines if something is wrong - not the user. Imagine that before you go home, you set the computer to run through a million swisprot entries. The next day, you must be able to see what failed. In a sense you don&#039;t care about what succeeded, as that is the common case. You care about what failed, because it is here you must take action.&lt;br /&gt;
# Now that you have the ID, accession number and AA sequence save it to a file &#039;&#039;sprot.fsa&#039;&#039; in FASTA format. Look in the file &#039;&#039;dna.fsa&#039;&#039; for an example of FASTA. Notice the first line starts with &amp;gt; and immediately after comes an unique identifier, like an accession number or a SwissProt ID. Any other data must be on the header line only, but in free format. Sequence data is on the following lines. &amp;lt;br&amp;gt;Notice that this exercise incorporates the previous 4, but uses the result in a slightly different way.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Count the number of RA (Author) lines in the &#039;&#039;sprot1-4.dat&#039;&#039; files. &#039;&#039;sprot2.dat&#039;&#039; contains 25 RA lines.&lt;br /&gt;
* Extract the author names from the RA lines in the &#039;&#039;sprot1-4.dat&#039;&#039; files. Display the names - only the names.&lt;br /&gt;
* Continuing previous exercise: Now also extract the title (RT lines). Display like title first on one line, followed by authors on the next. Then empty line followed by the next title and authors and so forth, until no more authors/titles.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Python_Input-Output&amp;diff=78</id>
		<title>Python Input-Output</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Python_Input-Output&amp;diff=78"/>
		<updated>2024-10-30T09:19:27Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises for extra practice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Pseudocode and Comments]]&lt;br /&gt;
|Next: [[Exceptions and Bug Handling]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_06-InputOutput.ppt Input, output, libraries and strings]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=0f769984-a650-444f-bb2c-af27012e79b3 File reading and writing]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=67d3cdd4-7843-4a31-a53d-af27012e62de Python libraries]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=4ae29c7b-972d-4441-863a-af27012e4042 Strings and substrings]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Biological knowledge needed in the course]]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Input Output]]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] Every time you read it, you will take something from it.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://video.dtu.dk/media/22110-lesson04-LiveCoding/0_fua9gb78 Live Coding] FAILED&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=0e86b23b-eabd-4a51-90cf-af1500a36b33 Python Pep Talk] Thursday&amp;lt;br&amp;gt;&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/36610/python_peptalk.pptx Python pep talk by Line Egerod Lund] Thursday&amp;lt;br&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
;Using files&lt;br /&gt;
:&#039;&#039;open&#039;&#039; which opens a file (makes it ready) for reading or writing.&lt;br /&gt;
:&#039;&#039;close&#039;&#039; which ends the reading/writing.&lt;br /&gt;
:&#039;&#039;readline&#039;&#039;, which reads a line from a file handle.&lt;br /&gt;
:&#039;&#039;write&#039;&#039;, which writes a line to a file (handle). &lt;br /&gt;
;String manipulation&lt;br /&gt;
:&#039;&#039;len&#039;&#039;, which tells how long a string is.&lt;br /&gt;
:Slicing.&lt;br /&gt;
;Standard library functions&lt;br /&gt;
:&#039;&#039;sys.exit&#039;&#039; terminates the program.&lt;br /&gt;
:&#039;&#039;os.system&#039;&#039;, which submits jobs to the operating system.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Write a program that counts the number of negative numbers in &#039;&#039;ex1.dat&#039;&#039; file. Display the result, which is 3272. Hint: Think about what defines a negative number.&lt;br /&gt;
# Write a program that converts temperatures from Fahrenheit to Celsius or visa versa given input like &amp;quot;36F&amp;quot; of &amp;quot;15C&amp;quot; ( F = (C * 9/5) + 32 ).&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;Read the file &#039;&#039;orphans.sp&#039;&#039; and find all accession numbers (and only the accession numbers), save them in another file of your choosing. Hint: an accession number might look like this AB000114.CDS.1 or like this AB000114 or like this AB000114.CDS.3. CDS means CoDing Sequence followed by a number. If the accession number contains the CDS part, consider .CDS.1 as a part of the accession number. Accession numbers differ in length for historical reasons. You can assume that the accession number comes straight after the &#039;&#039;&#039;&amp;gt;&#039;&#039;&#039;, which is first on the line. Notice that this is a purple exercise; You have make the pseudo code first and hand it in as part of the exercise.&amp;lt;/font&amp;gt;&lt;br /&gt;
# Now you must analyze the AT/GC content of the DNA in the file &#039;&#039;dna.dat&#039;&#039;. You must count all A, T, C and G, and display the result: A: 333 T: 303 C: 454 G: 469.&lt;br /&gt;
# This and the rest of the exercises aims to make the reverse complement string (called &amp;quot;complement strand&amp;quot;) of DNA. They are building up in complexity, but every exercise must stand alone, i.e. NOT be dependent on what the previous exercises achieved but start over every time in order to be a coherent product.&amp;lt;br&amp;gt;There is some human DNA in the &#039;&#039;dna.dat&#039;&#039; file. Read the file and put all the DNA in one variable. Now complement the DNA and store it in other variable. Display and ensure that it works. HINT: Complementing means changing all A&#039;s to T&#039;s, T&#039;s to A&#039;s, C&#039;s to G&#039;s and G&#039;s to C&#039;s.&lt;br /&gt;
# Now reverse the DNA after complementing it. Reverse means last letter (base) should be the first, next to last should be the second, and so forth. Display.&lt;br /&gt;
# Now write the DNA in the file &#039;&#039;revdna.dat&#039;&#039;. Make it look nice, just like &#039;&#039;dna.dat&#039;&#039;, i.e. 60 letters per line. This does NOT mean that you should insert newlines in the variable containing your complement strand (contamination of clean data you possibly should use later in the program). It just means that DNA in the output file must have 60 chars per line, just as in the input file.&lt;br /&gt;
# In the file &#039;&#039;dna.fsa&#039;&#039; is the same human DNA in FASTA format. This format is VERY often used in bioinformatics. Look at it using less and get used to the format. Observe the first line which starts with a &amp;gt; and identifies the sequence. The name (AB000410 in this case) MUST uniquely identify a sequence in the file. This is a DNA (actually mRNA) sequence taken from the GenBank database. Now make a program that reverse complements the sequence and writes it into the file &#039;&#039;revdna.fsa&#039;&#039; just like you did in previous assignments. This time you have to keep the first identifying line, so the sequence can be identified. You must add &#039;ComplementStrand&#039; in the end of that line, though, so you later know that it is the complement strand.&amp;lt;br&amp;gt;Summary: Keep the first line and reverse complement the sequence.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
Slicing: the act of taking out a substring (part of a string) from a string. Learning the technique of &amp;quot;walking the line&amp;quot;.&lt;br /&gt;
* Input a line from the keyboard. Count the number of stars * on the line. Display. Example: DG*GDG*GSD*GG&amp;lt;br&amp;gt;Star count: 3&lt;br /&gt;
* Input a line from the keyboard. Now print the characters on the line vertically, i.e. one char per line downwards. Example: ABC&amp;lt;br&amp;gt;A&amp;lt;br&amp;gt;B&amp;lt;br&amp;gt;C&lt;br /&gt;
* Input a line from the keyboard. Now print 2 characters on the line vertically, i.e. two char per line downwards. Advance 1 char at a time. Example: ABC&amp;lt;br&amp;gt;AB&amp;lt;br&amp;gt;BC&lt;br /&gt;
* Input a line from the keyboard. Now print 2 characters on the line vertically, i.e. two char per line downwards. Advance 2 chars at a time. If there is a leftover char at the end of the string, print it. Example: ABCDE&amp;lt;br&amp;gt;AB&amp;lt;br&amp;gt;CD&amp;lt;br&amp;gt;E&lt;br /&gt;
* Input a line from the keyboard. Now print 2 characters on the line vertically, i.e. two char per line downwards. Advance 2 chars at a time. If there is leftover char at the end of the string, do NOT print it. Example: ABCDE&amp;lt;br&amp;gt;AB&amp;lt;br&amp;gt;CD&lt;br /&gt;
* Input a DNA line from the keyboard. Now print 3 characters (a codon) on the line vertically, i.e. three char per line downwards. Advance 3 chars at a time. If there is a leftover DNA that can not constitute a codon at the end of the string, do NOT print it. Example: TACCATCGATCAG&amp;lt;br&amp;gt;TAC&amp;lt;br&amp;gt;CAT&amp;lt;br&amp;gt;CGA&amp;lt;br&amp;gt;TCA&lt;br /&gt;
* Input a sentence (a line) from the keyboard. Write every word on its own line. Example: The answer is 42.&amp;lt;br&amp;gt;The&amp;lt;br&amp;gt;answer&amp;lt;br&amp;gt;is&amp;lt;br&amp;gt;42.&lt;br /&gt;
Opening files.&lt;br /&gt;
* Ask for 2 input file names (&#039;&#039;ex1.acc&#039;&#039;  &amp;amp; &#039;&#039;ex1.dat&#039;&#039; are good) and an output file name. Copy (read and write) the input files into the output file, one after the other.&lt;br /&gt;
* Ask for 2 input file names (&#039;&#039;ex1.acc&#039;&#039;  &amp;amp; &#039;&#039;ex1.dat&#039;&#039; are good) and an output file name. Now copy/print the lines in the input files into the output file so that the first line of each input file are merged together with a tab and becomes the first line of the output. Continue that way with all the lines in the input file. A mental picture of what is supposed to happen is this: Imagine the 2 input files to be two pieces of paper with lines. In the exercise before the papers were put one after the other in the output. In this exercise the papers are put next to each other (sideways) in the output.&lt;br /&gt;
* Read the &#039;&#039;mixedlines.txt&#039;&#039; and count how many long lines there are in the file. A long line has more than 30 chars. (60)&lt;br /&gt;
* In &#039;&#039;mixedlines.txt&#039;&#039; how many occurrences for &amp;quot;rna&amp;quot; can you find? (7)&lt;br /&gt;
* In &#039;&#039;mixedlines.txt&#039;&#039; how many lines contain &amp;quot;rna&amp;quot;? (6)&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Python_Input-Output&amp;diff=77</id>
		<title>Python Input-Output</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Python_Input-Output&amp;diff=77"/>
		<updated>2024-10-30T09:18:21Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Pseudocode and Comments]]&lt;br /&gt;
|Next: [[Exceptions and Bug Handling]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_06-InputOutput.ppt Input, output, libraries and strings]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=0f769984-a650-444f-bb2c-af27012e79b3 File reading and writing]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=67d3cdd4-7843-4a31-a53d-af27012e62de Python libraries]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=4ae29c7b-972d-4441-863a-af27012e4042 Strings and substrings]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Biological knowledge needed in the course]]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Input Output]]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] Every time you read it, you will take something from it.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://video.dtu.dk/media/22110-lesson04-LiveCoding/0_fua9gb78 Live Coding] FAILED&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=0e86b23b-eabd-4a51-90cf-af1500a36b33 Python Pep Talk] Thursday&amp;lt;br&amp;gt;&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/36610/python_peptalk.pptx Python pep talk by Line Egerod Lund] Thursday&amp;lt;br&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
;Using files&lt;br /&gt;
:&#039;&#039;open&#039;&#039; which opens a file (makes it ready) for reading or writing.&lt;br /&gt;
:&#039;&#039;close&#039;&#039; which ends the reading/writing.&lt;br /&gt;
:&#039;&#039;readline&#039;&#039;, which reads a line from a file handle.&lt;br /&gt;
:&#039;&#039;write&#039;&#039;, which writes a line to a file (handle). &lt;br /&gt;
;String manipulation&lt;br /&gt;
:&#039;&#039;len&#039;&#039;, which tells how long a string is.&lt;br /&gt;
:Slicing.&lt;br /&gt;
;Standard library functions&lt;br /&gt;
:&#039;&#039;sys.exit&#039;&#039; terminates the program.&lt;br /&gt;
:&#039;&#039;os.system&#039;&#039;, which submits jobs to the operating system.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Write a program that counts the number of negative numbers in &#039;&#039;ex1.dat&#039;&#039; file. Display the result, which is 3272. Hint: Think about what defines a negative number.&lt;br /&gt;
# Write a program that converts temperatures from Fahrenheit to Celsius or visa versa given input like &amp;quot;36F&amp;quot; of &amp;quot;15C&amp;quot; ( F = (C * 9/5) + 32 ).&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;Read the file &#039;&#039;orphans.sp&#039;&#039; and find all accession numbers (and only the accession numbers), save them in another file of your choosing. Hint: an accession number might look like this AB000114.CDS.1 or like this AB000114 or like this AB000114.CDS.3. CDS means CoDing Sequence followed by a number. If the accession number contains the CDS part, consider .CDS.1 as a part of the accession number. Accession numbers differ in length for historical reasons. You can assume that the accession number comes straight after the &#039;&#039;&#039;&amp;gt;&#039;&#039;&#039;, which is first on the line. Notice that this is a purple exercise; You have make the pseudo code first and hand it in as part of the exercise.&amp;lt;/font&amp;gt;&lt;br /&gt;
# Now you must analyze the AT/GC content of the DNA in the file &#039;&#039;dna.dat&#039;&#039;. You must count all A, T, C and G, and display the result: A: 333 T: 303 C: 454 G: 469.&lt;br /&gt;
# This and the rest of the exercises aims to make the reverse complement string (called &amp;quot;complement strand&amp;quot;) of DNA. They are building up in complexity, but every exercise must stand alone, i.e. NOT be dependent on what the previous exercises achieved but start over every time in order to be a coherent product.&amp;lt;br&amp;gt;There is some human DNA in the &#039;&#039;dna.dat&#039;&#039; file. Read the file and put all the DNA in one variable. Now complement the DNA and store it in other variable. Display and ensure that it works. HINT: Complementing means changing all A&#039;s to T&#039;s, T&#039;s to A&#039;s, C&#039;s to G&#039;s and G&#039;s to C&#039;s.&lt;br /&gt;
# Now reverse the DNA after complementing it. Reverse means last letter (base) should be the first, next to last should be the second, and so forth. Display.&lt;br /&gt;
# Now write the DNA in the file &#039;&#039;revdna.dat&#039;&#039;. Make it look nice, just like &#039;&#039;dna.dat&#039;&#039;, i.e. 60 letters per line. This does NOT mean that you should insert newlines in the variable containing your complement strand (contamination of clean data you possibly should use later in the program). It just means that DNA in the output file must have 60 chars per line, just as in the input file.&lt;br /&gt;
# In the file &#039;&#039;dna.fsa&#039;&#039; is the same human DNA in FASTA format. This format is VERY often used in bioinformatics. Look at it using less and get used to the format. Observe the first line which starts with a &amp;gt; and identifies the sequence. The name (AB000410 in this case) MUST uniquely identify a sequence in the file. This is a DNA (actually mRNA) sequence taken from the GenBank database. Now make a program that reverse complements the sequence and writes it into the file &#039;&#039;revdna.fsa&#039;&#039; just like you did in previous assignments. This time you have to keep the first identifying line, so the sequence can be identified. You must add &#039;ComplementStrand&#039; in the end of that line, though, so you later know that it is the complement strand.&amp;lt;br&amp;gt;Summary: Keep the first line and reverse complement the sequence.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
Slicing: the act of taking out a substring (part of a string) from a string. Learning the technique of &amp;quot;walking the line&amp;quot;.&lt;br /&gt;
* Input a line from the keyboard. Count the number of stars * on the line. Display. Example: DG*GDG*GSD*GG&amp;lt;br&amp;gt;Star count: 3&lt;br /&gt;
* Input a line from the keyboard. Now print the characters on the line vertically, i.e. one char per line downwards. Example: ABC&amp;lt;br&amp;gt;A&amp;lt;br&amp;gt;B&amp;lt;br&amp;gt;C&lt;br /&gt;
* Input a line from the keyboard. Now print 2 characters on the line vertically, i.e. two char per line downwards. Advance 1 char at a time. Example: ABC&amp;lt;br&amp;gt;AB&amp;lt;br&amp;gt;BC&lt;br /&gt;
* Input a line from the keyboard. Now print 2 characters on the line vertically, i.e. two char per line downwards. Advance 2 chars at a time. If there is a leftover char at the end of the string, print it. Example: ABCDE&amp;lt;br&amp;gt;AB&amp;lt;br&amp;gt;CD&amp;lt;br&amp;gt;E&lt;br /&gt;
* Input a line from the keyboard. Now print 2 characters on the line vertically, i.e. two char per line downwards. Advance 2 chars at a time. If there is leftover char at the end of the string, do NOT print it. Example: ABCDE&amp;lt;br&amp;gt;AB&amp;lt;br&amp;gt;CD&lt;br /&gt;
* Input a DNA line from the keyboard. Now print 3 characters (a codon) on the line vertically, i.e. three char per line downwards. Advance 3 chars at a time. If there is a leftover DNA that can not constitute a codon at the end of the string, do NOT print it. Example: TACCATCGATCAG&amp;lt;br&amp;gt;TAC&amp;lt;br&amp;gt;CAT&amp;lt;br&amp;gt;CGA&amp;lt;br&amp;gt;TCA&lt;br /&gt;
* Input a sentence (a line) from the keyboard. Write every word on its own line. Example: The answer is 42.&amp;lt;br&amp;gt;The&amp;lt;br&amp;gt;answer&amp;lt;br&amp;gt;is&amp;lt;br&amp;gt;42.&lt;br /&gt;
Opening files.&lt;br /&gt;
* Ask for 2 input file names (&#039;&#039;ex1.acc&#039;&#039;  &amp;amp; &#039;&#039;ex1.dat&#039;&#039; are good) and an output file name. Copy (read and write) the input files into the output file, one after the other.&lt;br /&gt;
* Ask for 2 input file names (&#039;&#039;ex1.acc&#039;&#039;  &amp;amp; &#039;&#039;ex1.dat&#039;&#039; are good) and an output file name. Now copy/print the lines in the input files into the output file so that the first line of each input file are merged together with a tab and becomes the first line of the output. Continue that way with all the lines in the input file. A mental picture of what is supposed to happen is this: Imagine the 2 input files to be two pieces of paper with lines. In the exercise before the papers were put one after the other in the output. In this exercise the papers are put next to each other (sideways) in the output.&lt;br /&gt;
* Read the &#039;&#039;mixedlines.txt&#039;&#039; and count how many long lines there are in the file. A long line has more than 30 chars.&lt;br /&gt;
* In &#039;&#039;mixedlines.txt&#039;&#039; how many occurrences for &amp;quot;rna&amp;quot; can you find?&lt;br /&gt;
* In &#039;&#039;mixedlines.txt&#039;&#039; how many lines contain &amp;quot;rna&amp;quot;?&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Pseudocode_and_Comments&amp;diff=76</id>
		<title>Pseudocode and Comments</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Pseudocode_and_Comments&amp;diff=76"/>
		<updated>2024-10-30T09:10:44Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Simple File Reading]]&lt;br /&gt;
|Next: [[Python Input-Output]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_05-PseudoComments.ppt Pseudocode, comments and user interface]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=79ac24c4-603c-4a6e-9343-af2701292c8c The use of pseudocode and comments] &amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e2e3be56-6210-4e62-84d0-b1f600a3af21 Playing the guessing game], strategies and advice.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d5c0132e-cc4e-4e1a-bc99-af27012a777e Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/18/affordances-and-metaphors/ On User Interface 1], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/22/consistency-and-other-hobgoblins/ On User Interface 2], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/26/designing-for-people-who-have-better-things-to-do-with-their-lives/ On User Interface 3], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/05/09/the-process-of-designing-a-product/ Designing the software product], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
&#039;&#039;Pseudo code&#039;&#039;, which is &amp;quot;pretend&amp;quot; code, that tries to look like a program.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;Comments&#039;&#039;, which is essential for understanding, maintenance, explanation, memory and other good stuff.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;User interface&#039;&#039;, how the program should interact with the user.&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
In all these exercises, start with writing pseudo code first and the program after.&lt;br /&gt;
&amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;&lt;br /&gt;
# Make a program that asks for two numbers (integers), and calculates the mean (average) of those numbers. The mean must be converted to an integer. Displays result along with input numbers. Make sure what is displayed is explained well.&lt;br /&gt;
# Write a program that asks for a file name and then open the file and count the number of empty lines and non-empty lines in the file. Display the two counts. Test it on the &#039;&#039;mixedlines.txt&#039;&#039; file.&amp;lt;br&amp;gt;Warning: Just because you can not see it, it does not mean it does not exists. Invisible characters have long been a curse of programmers. So do not make them yourself. Hint: &#039;&#039;mixedlines.txt&#039;&#039; has 19 empty lines and 66 non-empty lines.&lt;br /&gt;
# Returning to last weeks exercise 4, where you had to ask for a file name and you program would then calculate the average of the numbers in the file. Do the same this time, except you have to continue to ask for file names and calculate the average until you enter nothing - no file name. Test on the same files as last time.&lt;br /&gt;
# Now for some playing. Make a program that guesses a number between 1 and 10 that you think of. It should make a guess, and you shall answer yes (if correctly guessed), higher (if the number you think of is higher than the guess) or lower (if the number you think of is lower than the guess). The program ends when the number is guessed correctly, otherwise it tries again. It is NOT considered OK to guess at a number more than once, i.e. no repeats. It is counterproductive to try to make this random guessing. Also think about how simple you can make this and still fulfill the wording of the exercises. Just don&#039;t run with the first idea you get. Don&#039;t embellish with additional functionality - it will just get difficult and we save that for later. Just to be clear - the number you think of must nowhere be in the program.&lt;br /&gt;
# Make a program that asks for a positive integer. Then it should print the same number of lines. On the first line there must be one &#039;&#039;&#039;#&#039;&#039;&#039;, second line two &#039;&#039;&#039;#&#039;&#039;&#039;, third line three &#039;&#039;&#039;#&#039;&#039;&#039;, and so forth. Do not enter too high a number or you will regret it. This will give the shape of a triangle.&lt;br /&gt;
# Let&#039;s play with shapes for a bit. Make programs that prints at least two of these shapes, one program per shape. It does not have to match my shapes exactly. Hint; think of printing one char at a time in a grid. That means one each line one char is printed at a time. You have to decide what to print based on the line and position in the line of the char.&amp;lt;br&amp;gt;[[File:shapes.png|800px]]&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Ask for a filename. Open the file and read and display the lines in a loop. However, if the line is empty, do not display it. Try on &#039;&#039;mixedlines.txt&#039;&#039;.&lt;br /&gt;
* Ask for a number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good. Open the file and count how many numbers are lower than your input number. Display the result.&lt;br /&gt;
* Ask for a number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good. Open the file and read the number on the lines. Compute two sums; the sum of numbers higher than your input number and the sum of numbers lower than your input number. Display the result.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Simple_File_Reading&amp;diff=75</id>
		<title>Simple File Reading</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Simple_File_Reading&amp;diff=75"/>
		<updated>2024-10-30T09:05:36Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python Basics]]&lt;br /&gt;
|Next: [[Pseudocode and Comments]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_04-FileReading.ppt Simple File Reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e51d5f37-84e5-46d4-8252-af270129a697 Simple file reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=def721bf-4e23-407c-9a5b-af2701298919 Objects, the concept. Some examples]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=18b01d1b-91b8-4e22-9303-af27012967ce Loop control, pass statement]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=07d50a0f-d574-444a-9cc9-af27012947c8 Boolean Logic, short-circuit evaluation ]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
&#039;&#039;with&#039;&#039; statement, just a simple use of it.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;open&#039;&#039; function for opening files for access. Filehandles.&amp;lt;br&amp;gt;&lt;br /&gt;
Built-in values; &#039;&#039;True&#039;&#039;, &#039;&#039;False&#039;&#039; and &#039;&#039;None&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Loop control with &#039;&#039;continue&#039;&#039; and &#039;&#039;break&#039;&#039; and how NOT to use them.&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Write a program that reads the file &#039;&#039;ex1.acc&#039;&#039; and displays it on the screen. Display it &#039;&#039;&#039;correctly&#039;&#039;&#039; as it is, i.e. the OUTPUT of your print should look precisely like the original file. Hint: look at the spacing between lines.&lt;br /&gt;
# Make the program ask for a filename (the input file in the following exercises), and display the file on the screen.&lt;br /&gt;
# Construct a program that counts the number of lines in the input file, and displays the result. Try it with the file &#039;&#039;ex1.dat&#039;&#039;. There are 1675 lines.&lt;br /&gt;
# Now make a Python program that sums numbers from ONE input file and displays the sum of the numbers. I have created 3 input files with the columns from &#039;&#039;ex1.dat&#039;&#039;; &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039;. Use the 3 files as input ONE AT A TIME and see the sums. The sums are approx. Col 1; -904.4143, Col 2; 482.8410, Col 3; 292.05150 for the three columns.&lt;br /&gt;
# Based on the previous program, now make a new one that calculates the mean value of the columns. Create your own test file with some numbers (where you know what the result should be) and feed that to the program.&lt;br /&gt;
# Now make a program that counts the number of positive and negative numbers in an input file. Also count the zeroes in the column, if there are any. Display the result.&lt;br /&gt;
# Now make a program that finds the maximum number in a column. Display the result. This is quite tricky. Hint: &#039;&#039;&#039;None&#039;&#039;&#039; could be useful. The max in &#039;&#039;ex1_1.dat&#039;&#039; is 10.4155.&lt;br /&gt;
# Now make a program that finds the minimum number in a column and display the result. The max in &#039;&#039;ex1_3.dat&#039;&#039; is -4.3967. Hint: What happens if all the numbers in the file are positive.&lt;br /&gt;
# It begins to get trivial. Now make a program that does all of the above, that is; calculate the sum, the number of lines, the mean value, the number of positive, negative and zero numbers, the maximum and the minimum value. You can only read the file once. Display the all results clearly so there is no doubt about what you display.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Ask for some input - it could be a word or a number or a sentence. Then ask for a file name - any file will do, but &#039;&#039;mixedlines.txt&#039;&#039; or &#039;&#039;ex5.acc&#039;&#039; are good. Now read the file and determine if one (or more) of the lines in the file matches your input precisely. Display &amp;quot;Match&amp;quot; or &amp;quot;No  match&amp;quot; accordingly. Hint: A line from a file has a newline at the end, but using the &#039;&#039;&#039;input&#039;&#039;&#039; function does not result in this newline.&lt;br /&gt;
* For extra difficulty, do the same program once more, but this time, it should only say &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; once, no matter how many matches there are. Make your own test file, with lots of the same number or word. If you already solved this in above exercise - good for you.&lt;br /&gt;
* Ask for 2 integers. Now print the first 20 numbers of the [https://en.wikipedia.org/wiki/Fibonacci_number Fibonacci sequence] given by those numbers. If the input is 1 &amp;amp; 3, the output would be 1 3 4 7 11 18 29 47 etc.. The next number is the sum of the 2 previous.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Exceptions_and_Bug_Handling&amp;diff=74</id>
		<title>Exceptions and Bug Handling</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Exceptions_and_Bug_Handling&amp;diff=74"/>
		<updated>2024-10-30T08:55:37Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python Input-Output]]&lt;br /&gt;
|Next: [[Stateful Parsing]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_07-Exceptions.ppt Exceptions and Bug Handling]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d230fcd7-c06c-414e-a14d-af27012e22f6 Exceptions]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d2136eb3-c9cb-414d-a0dc-af27012daa40 Exceptions example code]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=149168ad-61c5-4ad6-bad0-af27012e0077 Formatting data]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=08e7ed65-afe3-4f53-9d21-af27012de2bf Comparing many values]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=1255c184-8256-41d9-afc0-af27012dc955 Finding errors in your program]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=5e77fe45-be78-4ecf-a5f5-b1f600a24a62 Playing the guessing game], detecting lies and endings.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Exceptions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=acd48c9a-cacb-4832-9184-af27012c7021 Live coding]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
How to structure your code in distinct parts.&amp;lt;br&amp;gt;&lt;br /&gt;
Finding bugs in your program, using &#039;&#039;exceptions&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Formatting strings using the methods &#039;&#039;&#039;format&#039;&#039;&#039;, &#039;&#039;&#039;upper&#039;&#039;&#039; and &#039;&#039;&#039;lower&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# In the file &#039;&#039;dna.fsa&#039;&#039; is some DNA. Construct a program that finds possible translation starts :-)&amp;lt;br&amp;gt;All proteins start with the amino acid methionine (at least when translating, Met might be removed in later processing states). Methionine is coded with ATG. The exercise is therefore; find the position of all ATG&#039;s in the sequence. The first position is 83 as humans count. &amp;lt;br&amp;gt;In some organisms different start codons are possible. If you really want to, you can make the program handle those cases too.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;Connecting to the previous exercise; Assuming that the first Met at position 83 is translation start, find the corresponding translation stop (which is the first one in frame). Stop codon is coded by TAA, TAG, or TGA. Remember that the stop codon has to be in the same reading frame as ATG. Notice: There are two ways to solving this exercise. The primitive way is to start at the position given. The more general and better way is to find the first ATG and then find the corresponding stop codon, which is on position 128.&amp;lt;/font&amp;gt;&lt;br /&gt;
# &amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;Make a program that asks for an organism, like &#039;HUMAN&#039; or &#039;RAT&#039;. The program should then count the number of lines/times a SwissProt identifier in the file &#039;&#039;orphans.sp&#039;&#039; is present with said organism, ie. PARG_HUMAN and LUM_HUMAN are the two first for HUMAN. Hint: you should probably think twice in this exercise. The position is significant. Check what happens if you search for RAT.&amp;lt;/font&amp;gt;&lt;br /&gt;
# Count the ATCG&#039;s in the sequence in &#039;&#039;dna.fsa&#039;&#039;. Display the percentage of ATCG&#039;s with 2 digits after the dot. Make  it look really structured. Just to be exceedingly clear; the percentage of A&#039;s is 100*(NumberOfA/LengthOfSequence).&lt;br /&gt;
# Playing time again. Make the guessing program (lesson 4, exercise 4) count how many attempts it needed to guess the number and print it when done guessing. It must be able to detect if you lie (and say so, of course). Also, if you haven&#039;t done it before, make the program guess in the fewest possible guesses (an example of &#039;binary search&#039;). This is what most people naturally do by themselves when they play the game. You &#039;just&#039; have to do it in the program. There is a system, a method - find it. Hint: it is probably better to start over than reuse your old program.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* In a file you make yourself are numbers and words with one number/word on each line. Now make a program that reads the file and sums the numbers and displays the result. The words are ignored.&lt;br /&gt;
* In the file &#039;&#039;mixedlines.txt&#039;&#039; how many 4 letter words exists? A word is here defined as consecutive visible characters, i.e. &amp;quot;12&amp;quot;,  &amp;quot;ipsum.&amp;quot; are both words.&lt;br /&gt;
* Write a program that asks for an integer, and then determines if the number was a prime number or not.&lt;br /&gt;
* Write a program that prints a &amp;quot;bulls-eye&amp;quot; to the screen using characters like; &#039;.&#039;, &#039;+&#039;, &#039;*&#039;, &#039;#&#039;, etc.&amp;lt;br&amp;gt;You have to import the math library, in order to access the squareroot (sqrt), sine (sin), cosine (cos), and so forth functions. The square root of x is gotten like math.sqrt(x). I only used: for, if, elif, print, +, -, /, **, int, sqrt for this 40x40 example.&amp;lt;br&amp;gt;Hint: Think of a grid where one point is the center of the eye/circle. The positions in the grid will use different chars, depending how far away they are from the center. You might get an oval shape - think about why.&amp;lt;br&amp;gt;[[File:BullsEye.png]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Stateful_Parsing&amp;diff=73</id>
		<title>Stateful Parsing</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Stateful_Parsing&amp;diff=73"/>
		<updated>2024-10-30T08:53:42Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Exceptions and Bug Handling]]&lt;br /&gt;
|Next: [[Lists/Sequences]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_08-StatefulParsing.ppt Stateful Parsing]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=fe50507e-9009-49b1-a3a8-af27012d8cdf Stateful Parsing]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=ce785005-14cd-424a-a406-af27012b3e1b Finding errors with Stateful Parsing]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=acd48c9a-cacb-4832-9184-af27012c7021 Live coding]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Using stateful parsing to extract data spanning several lines, by recognizing keywords.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
The following 5 exercises deal with SwissProt. The file sprot1.dat is a SwissProt database entry. Study it carefully. Locate the SwissProt ID (SP96_DICDI), the accession number (P14328) and the amino acid sequence (MRVLLVLVAC....TTTATTTATS). There are other entries ( &#039;&#039;sprot2.dat&#039;&#039;, &#039;&#039;sprot3.dat&#039;&#039;, &#039;&#039;sprot4.dat&#039;&#039;). Your programs should work on those, too. Also your programs must solve all the problems in ONE reading of the file. It is acceptable if you just hand in one program that solves 1 to 4. 5 is separate. These exercises are about studying and understanding the file format.&lt;br /&gt;
# Make a program that reads the ID and prints it.&lt;br /&gt;
# Add the following functionality to the program: Read the accession number and print it.&lt;br /&gt;
# Add the following functionality to the program: Read the amino acid sequence and print it. You really should use Stateful Parsing in this exercise. Maybe check the video.&lt;br /&gt;
# Add the following functionality to the program: Verification of amino acid number. This means extract the number from the SQ line (example: SQ SEQUENCE 629 AA;) and check that the amino acid sequence has that number of residues. It should be the program that determines if something is wrong - not the user. Imagine that before you go home, you set the computer to run through a million swisprot entries. The next day, you must be able to see what failed. In a sense you don&#039;t care about what succeeded, as that is the common case. You care about what failed, because it is here you must take action.&lt;br /&gt;
# Now that you have the ID, accession number and AA sequence save it to a file &#039;&#039;sprot.fsa&#039;&#039; in FASTA format. Look in the file &#039;&#039;dna.fsa&#039;&#039; for an example of FASTA. Notice the first line starts with &amp;gt; and immediately after comes an unique identifier, like an accession number or a SwissProt ID. Any other data must be on the header line only, but in free format. Sequence data is on the following lines. &amp;lt;br&amp;gt;Notice that this exercise incorporates the previous 4, but uses the result in a slightly different way.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Count the number of RA (Author) lines in the &#039;&#039;sprot1-4.dat&#039;&#039; files.&lt;br /&gt;
* Extract the author names from the RA lines in the &#039;&#039;sprot1-4.dat&#039;&#039; files. Display the names - only the names.&lt;br /&gt;
* Continuing previous exercise: Now also extract the title (RT lines). Display like title first on one line, followed by authors on the next. Then empty line followed by the next title and authors and so forth, until no more authors/titles.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=72</id>
		<title>Lists/Sequences</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=72"/>
		<updated>2024-10-30T08:51:44Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises for extra practice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Stateful Parsing]]&lt;br /&gt;
|Next: [[More with Lists]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_09-Lists.ppt Lists and Sequences]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=871af158-9477-47c6-8e89-af27012d6e8d The basics of lists in python]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e3b143a8-962c-40ee-bd10-af27012d502c Working with lists, modification]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Lists and sequences.&amp;lt;br&amp;gt;&lt;br /&gt;
Lists methods for list manipulation;&amp;lt;br&amp;gt;&lt;br /&gt;
* changing an element&lt;br /&gt;
* adding/removing an element&lt;br /&gt;
* adding/removing more elements&lt;br /&gt;
* adding/removing elements at specific places&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Make a program that ask for words - one at a time - and saves them in a list (one word per element) until you write STOP. When STOP is entered, write the words in entered order in a file called &#039;&#039;words.txt&#039;&#039;.&lt;br /&gt;
# Searching for accession numbers. In the file &#039;&#039;ex5.acc&#039;&#039; there are 6461 unique GenBank accession numbers (taken from HU6800 DNA array chip). An inexperienced bioinformatician unfortunately fouled up the list, so many of the accession numbers appears more than once. Make a program that first reads the file into a list, then ask for an accession number and counts how many times it appears in the list and displays the result.&lt;br /&gt;
# Different search for accession numbers. This program is similar to the above. First read the file into a list, then continue to ask for accession numbers and check if they are in the list (yes/no, not a count). Keep searching for accession numbers until STOP is entered. Hint: this is 2 loops inside one another.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;You need to clean up the &#039;&#039;ex5.acc&#039;&#039; file. The first step is to sort the accession numbers alphabetically. You must program a sorting algorithm. There are many different algorithms for sorting, but let&#039;s pick a simple one - Bubble Sort.&amp;lt;br&amp;gt;It goes like this. Read the accessions into a list like the previous exercises. Go through the list looking at pairs of accessions (at position i &amp;amp; i+1). If a pair is in the wrong order, you switch them. Repeat going through the list until you have gone through the entire list without switching once. Now the list is sorted and you save the list in the &#039;&#039;sorted5.acc&#039;&#039; file.&amp;lt;br&amp;gt;Note: &#039;&#039;&#039;It takes 10-30 sec to run this program&#039;&#039;&#039;. There is room for optimization in the described algorithm and it is in any case not the most efficient method. You are free to implement a different method.&amp;lt;/font&amp;gt;&lt;br /&gt;
# It is now time to find the unique accession numbers, so you only have one of each - no duplicates. Read the accessions from &#039;&#039;sorted5.acc&#039;&#039; into a list. Since the list is now sorted, the duplicates are &amp;quot;next&amp;quot; to each other, which makes them easy to find. Make a &#039;&#039;&#039;new&#039;&#039;&#039; list with the unique accessions from the old list, and save that list in the file &#039;&#039;clean5.acc&#039;&#039;. Check that you have 6461 accessions, one per line.&lt;br /&gt;
# In this exercise you have to do the same and achieve the same result in a different way as the previous exercise. Instead of making a new list with the unique accessions, just keep the old list and remove the duplicates. You can use &#039;&#039;&#039;del&#039;&#039;&#039; or &#039;&#039;&#039;pop&#039;&#039;&#039; to remove elements. If you run into trouble imagine your code executed on this list: [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Read two files with numbers into two lists. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this. Now add the numbers together, like the first number in the first file with the first number in the second file, and so forth, i.e. add the column in the file row-wise. You could also consider the numbers in a file to be a vector, and then you add two vectors together. Save the output (a list of numbers, one number per line) in a new file - you decide the name.&lt;br /&gt;
* Continuing previous exercise: Corrupt your input files a bit, change some numbers to not-numbers, like words or empty lines. Make your program work on these files too, assuming anything you can not read is ignored - consider any line you can not convert to a number as containing a zero.&lt;br /&gt;
* Continuing previous exercise: Make the program work even if the input files do not have the same length, just assume zero for the missing lines in the short file. BTW, you do not know which input is short.&lt;br /&gt;
* Read a file with numbers into two lists. The first number in the file goes to the first list, the second number to the second list, the third number to the first list, and so forth - alternating numbers to alternating lists. Compute the sum of the two lists and display. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;br /&gt;
* Now compute the same sums - without the lists :-)&lt;br /&gt;
* Ask for files names and read the numbers in the file into a list. Continue to ask for file names and add the numbers to the list until you enter STOP. Your list of numbers will simply grow with each file you add. Now compute the sum of the numbers in the list and display the result. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=71</id>
		<title>Lists/Sequences</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=71"/>
		<updated>2024-10-30T08:50:46Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises for extra practice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Stateful Parsing]]&lt;br /&gt;
|Next: [[More with Lists]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_09-Lists.ppt Lists and Sequences]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=871af158-9477-47c6-8e89-af27012d6e8d The basics of lists in python]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e3b143a8-962c-40ee-bd10-af27012d502c Working with lists, modification]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Lists and sequences.&amp;lt;br&amp;gt;&lt;br /&gt;
Lists methods for list manipulation;&amp;lt;br&amp;gt;&lt;br /&gt;
* changing an element&lt;br /&gt;
* adding/removing an element&lt;br /&gt;
* adding/removing more elements&lt;br /&gt;
* adding/removing elements at specific places&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Make a program that ask for words - one at a time - and saves them in a list (one word per element) until you write STOP. When STOP is entered, write the words in entered order in a file called &#039;&#039;words.txt&#039;&#039;.&lt;br /&gt;
# Searching for accession numbers. In the file &#039;&#039;ex5.acc&#039;&#039; there are 6461 unique GenBank accession numbers (taken from HU6800 DNA array chip). An inexperienced bioinformatician unfortunately fouled up the list, so many of the accession numbers appears more than once. Make a program that first reads the file into a list, then ask for an accession number and counts how many times it appears in the list and displays the result.&lt;br /&gt;
# Different search for accession numbers. This program is similar to the above. First read the file into a list, then continue to ask for accession numbers and check if they are in the list (yes/no, not a count). Keep searching for accession numbers until STOP is entered. Hint: this is 2 loops inside one another.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;You need to clean up the &#039;&#039;ex5.acc&#039;&#039; file. The first step is to sort the accession numbers alphabetically. You must program a sorting algorithm. There are many different algorithms for sorting, but let&#039;s pick a simple one - Bubble Sort.&amp;lt;br&amp;gt;It goes like this. Read the accessions into a list like the previous exercises. Go through the list looking at pairs of accessions (at position i &amp;amp; i+1). If a pair is in the wrong order, you switch them. Repeat going through the list until you have gone through the entire list without switching once. Now the list is sorted and you save the list in the &#039;&#039;sorted5.acc&#039;&#039; file.&amp;lt;br&amp;gt;Note: &#039;&#039;&#039;It takes 10-30 sec to run this program&#039;&#039;&#039;. There is room for optimization in the described algorithm and it is in any case not the most efficient method. You are free to implement a different method.&amp;lt;/font&amp;gt;&lt;br /&gt;
# It is now time to find the unique accession numbers, so you only have one of each - no duplicates. Read the accessions from &#039;&#039;sorted5.acc&#039;&#039; into a list. Since the list is now sorted, the duplicates are &amp;quot;next&amp;quot; to each other, which makes them easy to find. Make a &#039;&#039;&#039;new&#039;&#039;&#039; list with the unique accessions from the old list, and save that list in the file &#039;&#039;clean5.acc&#039;&#039;. Check that you have 6461 accessions, one per line.&lt;br /&gt;
# In this exercise you have to do the same and achieve the same result in a different way as the previous exercise. Instead of making a new list with the unique accessions, just keep the old list and remove the duplicates. You can use &#039;&#039;&#039;del&#039;&#039;&#039; or &#039;&#039;&#039;pop&#039;&#039;&#039; to remove elements. If you run into trouble imagine your code executed on this list: [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Read two files with numbers into two lists. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this. Now add the numbers together, like the first number in the first file with the first number in the second file, and so forth, i.e. add the column in the file row-wise. You could also consider the numbers in a file to be a vector, and then you add two vectors together. Save the output (a list of numbers, one number per line) in a new file - you decide the name.&lt;br /&gt;
* Continuing previous exercise: Corrupt your input files a bit, change some numbers to not-numbers, like words or empty lines. Make your program work on these files too, assuming anything you can not read is ignored - consider any line you can not convert to a number as containing a zero.&lt;br /&gt;
* Continuing previous exercise: Make the program work even if the input files do not have the same length, just assume zero for the missing lines in the short file. BTW, you do not know which input is short.&lt;br /&gt;
* Read a file with numbers into two lists. The first number in the file goes to the first list, the second number to the second list, the third number to the first list, and so forth - alternating numbers to alternating lists. Compute the sum of the two lists and display. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;br /&gt;
* Now compute the same sums - without the lists :-)&lt;br /&gt;
* Ask for files names and read the numbers in the file into a list. Continue to ask for file names and add the numbers to the list until you enter STOP. Now compute the sum of the numbers in the list and display the result. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=70</id>
		<title>Lists/Sequences</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Lists/Sequences&amp;diff=70"/>
		<updated>2024-10-30T08:48:39Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Stateful Parsing]]&lt;br /&gt;
|Next: [[More with Lists]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_09-Lists.ppt Lists and Sequences]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=871af158-9477-47c6-8e89-af27012d6e8d The basics of lists in python]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e3b143a8-962c-40ee-bd10-af27012d502c Working with lists, modification]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
Lists and sequences.&amp;lt;br&amp;gt;&lt;br /&gt;
Lists methods for list manipulation;&amp;lt;br&amp;gt;&lt;br /&gt;
* changing an element&lt;br /&gt;
* adding/removing an element&lt;br /&gt;
* adding/removing more elements&lt;br /&gt;
* adding/removing elements at specific places&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Make a program that ask for words - one at a time - and saves them in a list (one word per element) until you write STOP. When STOP is entered, write the words in entered order in a file called &#039;&#039;words.txt&#039;&#039;.&lt;br /&gt;
# Searching for accession numbers. In the file &#039;&#039;ex5.acc&#039;&#039; there are 6461 unique GenBank accession numbers (taken from HU6800 DNA array chip). An inexperienced bioinformatician unfortunately fouled up the list, so many of the accession numbers appears more than once. Make a program that first reads the file into a list, then ask for an accession number and counts how many times it appears in the list and displays the result.&lt;br /&gt;
# Different search for accession numbers. This program is similar to the above. First read the file into a list, then continue to ask for accession numbers and check if they are in the list (yes/no, not a count). Keep searching for accession numbers until STOP is entered. Hint: this is 2 loops inside one another.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;You need to clean up the &#039;&#039;ex5.acc&#039;&#039; file. The first step is to sort the accession numbers alphabetically. You must program a sorting algorithm. There are many different algorithms for sorting, but let&#039;s pick a simple one - Bubble Sort.&amp;lt;br&amp;gt;It goes like this. Read the accessions into a list like the previous exercises. Go through the list looking at pairs of accessions (at position i &amp;amp; i+1). If a pair is in the wrong order, you switch them. Repeat going through the list until you have gone through the entire list without switching once. Now the list is sorted and you save the list in the &#039;&#039;sorted5.acc&#039;&#039; file.&amp;lt;br&amp;gt;Note: &#039;&#039;&#039;It takes 10-30 sec to run this program&#039;&#039;&#039;. There is room for optimization in the described algorithm and it is in any case not the most efficient method. You are free to implement a different method.&amp;lt;/font&amp;gt;&lt;br /&gt;
# It is now time to find the unique accession numbers, so you only have one of each - no duplicates. Read the accessions from &#039;&#039;sorted5.acc&#039;&#039; into a list. Since the list is now sorted, the duplicates are &amp;quot;next&amp;quot; to each other, which makes them easy to find. Make a &#039;&#039;&#039;new&#039;&#039;&#039; list with the unique accessions from the old list, and save that list in the file &#039;&#039;clean5.acc&#039;&#039;. Check that you have 6461 accessions, one per line.&lt;br /&gt;
# In this exercise you have to do the same and achieve the same result in a different way as the previous exercise. Instead of making a new list with the unique accessions, just keep the old list and remove the duplicates. You can use &#039;&#039;&#039;del&#039;&#039;&#039; or &#039;&#039;&#039;pop&#039;&#039;&#039; to remove elements. If you run into trouble imagine your code executed on this list: [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Read two files with numbers into two lists. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this. Now add the numbers together, like the first number in the first file with the first number in the second file, and so forth, i.e. add the column in the file row-wise. You could also consider the numbers in a file to be a vector, and then you add two vectors together. Save the output (a list of numbers, one number per line) in a new file - you decide the name.&lt;br /&gt;
* Continuing previous exercise: Corrupt your input files a bit, change some numbers to not-numbers, like words or empty lines. Make your program work on these files too, assuming anything you can not read is ignored - you can &amp;quot;pretend&amp;quot; that there is a zero on the line you can not convert to a number.&lt;br /&gt;
* Continuing previous exercise: Make the program work even if the input files do not have the same length, just assume zero for the missing lines in the short file. BTW, you do not know which input is short.&lt;br /&gt;
* Read a file with numbers into two lists. The first number in the file goes to the first list, the second number to the second list, the third number to the first list, and so forth - alternating numbers to alternating lists. Compute the sum of the two lists and display. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;br /&gt;
* Now compute the same sums - without the lists :-)&lt;br /&gt;
* Ask for files names and read the numbers in the file into a list. Continue to ask for file names and add the numbers to the list until you enter STOP. Now compute the sum of the numbers in the list and display the result. Files &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good to use for this.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Exceptions_and_Bug_Handling&amp;diff=69</id>
		<title>Exceptions and Bug Handling</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Exceptions_and_Bug_Handling&amp;diff=69"/>
		<updated>2024-10-08T04:23:35Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python Input-Output]]&lt;br /&gt;
|Next: [[Stateful Parsing]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_07-Exceptions.ppt Exceptions and Bug Handling]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d230fcd7-c06c-414e-a14d-af27012e22f6 Exceptions]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d2136eb3-c9cb-414d-a0dc-af27012daa40 Exceptions example code]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=149168ad-61c5-4ad6-bad0-af27012e0077 Formatting data]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=08e7ed65-afe3-4f53-9d21-af27012de2bf Comparing many values]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=1255c184-8256-41d9-afc0-af27012dc955 Finding errors in your program]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=5e77fe45-be78-4ecf-a5f5-b1f600a24a62 Playing the guessing game], detecting lies and endings.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Exceptions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=acd48c9a-cacb-4832-9184-af27012c7021 Live coding]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
How to structure your code in distinct parts.&amp;lt;br&amp;gt;&lt;br /&gt;
Finding bugs in your program, using &#039;&#039;exceptions&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Formatting strings using the methods &#039;&#039;&#039;format&#039;&#039;&#039;, &#039;&#039;&#039;upper&#039;&#039;&#039; and &#039;&#039;&#039;lower&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# In the file &#039;&#039;dna.fsa&#039;&#039; is some DNA. Construct a program that finds possible translation starts :-)&amp;lt;br&amp;gt;All proteins start with the amino acid methionine (at least when translating, Met might be removed in later processing states). Methionine is coded with ATG. The exercise is therefore; find the position of all ATG&#039;s in the sequence. The first position is 83 as humans count. &amp;lt;br&amp;gt;In some organisms different start codons are possible. If you really want to, you can make the program handle those cases too.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;Connecting to the previous exercise; Assuming that the first Met at position 83 is translation start, find the corresponding translation stop (which is the first one in frame). Stop codon is coded by TAA, TAG, or TGA. Remember that the stop codon has to be in the same reading frame as ATG. Notice: There are two ways to solving this exercise. The primitive way is to start at the position given. The more general and better way is to find the first ATG and then find the corresponding stop codon.&amp;lt;/font&amp;gt;&lt;br /&gt;
# &amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;Make a program that asks for an organism, like &#039;HUMAN&#039; or &#039;RAT&#039;. The program should then count the number of lines/times a SwissProt identifier in the file &#039;&#039;orphans.sp&#039;&#039; is present with said organism, ie. PARG_HUMAN and LUM_HUMAN are the two first for HUMAN. Hint: you should probably think twice in this exercise.&amp;lt;/font&amp;gt;&lt;br /&gt;
# Count the ATCG&#039;s in the sequence in &#039;&#039;dna.fsa&#039;&#039;. Display the percentage of ATCG&#039;s with 2 digits after the dot. Make  it look really structured. Just to be exceedingly clear; the percentage of A&#039;s is 100*(NumberOfA/LengthOfSequence).&lt;br /&gt;
# Playing time again. Make the guessing program (lesson 4, exercise 4) count how many attempts it needed to guess the number and print it when done guessing. It must be able to detect if you lie (and say so, of course). Also, if you haven&#039;t done it before, make the program guess in the fewest possible guesses (an example of &#039;binary search&#039;). This is what most people naturally do by themselves when they play the game. You &#039;just&#039; have to do it in the program. There is a system, a method - find it. Hint: it is probably better to start over than reuse your old program.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* In a file you make yourself are numbers and words with one number/word on each line. Now make a program that reads the file and sums the numbers and displays the result. The words are ignored.&lt;br /&gt;
* In the file &#039;&#039;mixedlines.txt&#039;&#039; how many 4 letter words exists? A word is here defined as consecutive visible characters, i.e. &amp;quot;12&amp;quot;,  &amp;quot;ipsum.&amp;quot; are both words.&lt;br /&gt;
* Write a program that asks for an integer, and then determines if the number was a prime number or not.&lt;br /&gt;
* Write a program that prints a &amp;quot;bulls-eye&amp;quot; to the screen using characters like; &#039;.&#039;, &#039;+&#039;, &#039;*&#039;, &#039;#&#039;, etc.&amp;lt;br&amp;gt;You have to import the math library, in order to access the squareroot (sqrt), sine (sin), cosine (cos), and so forth functions. The square root of x is gotten like math.sqrt(x). I only used: for, if, elif, print, +, -, /, **, int, sqrt for this 40x40 example.&amp;lt;br&amp;gt;Hint: Think of a grid where one point is the center of the eye/circle. The positions in the grid will use different chars, depending how far away they are from the center. You might get an oval shape - think about why.&amp;lt;br&amp;gt;[[File:BullsEye.png]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=68</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=68"/>
		<updated>2024-09-25T14:21:56Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Competences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=67</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=67"/>
		<updated>2024-09-25T14:17:43Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Competences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
It should be obvious that training these skills is beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=66</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=66"/>
		<updated>2024-09-25T14:13:39Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Competences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
It should be obvious that training these skills is beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;how do I make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=65</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=65"/>
		<updated>2024-09-25T14:12:00Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Competences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
It should be obvious that training these skills is beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
A single example of above:&amp;lt;br&amp;gt;&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;how do I make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression, and you do not really understand, because it is either outside or too early in the curriculum.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=64</id>
		<title>22101/22161 - Introduction to programming in Life Science using Python</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=22101/22161_-_Introduction_to_programming_in_Life_Science_using_Python&amp;diff=64"/>
		<updated>2024-09-25T14:09:23Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Course details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using Jupyter Notebook. [[Install Jupyter Notebook]] before you meet in class.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; There are no text books for the course. I will make do with powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22101 and 22161 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Tuesday 8:00 - 12:00, module E3-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room  to the other.&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2024&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
It should be obvious that training these skills is beneficial for the student, but they do not come for free - it is hard work, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
With the rise of Copilot/ChatGPT answers are easier to get than ever. If you insist on using such tools, be sure you do not use them in a way harmful to your learning.&lt;br /&gt;
Specifically, ask questions like &amp;quot;how does this work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot; as these questions promote learning.&lt;br /&gt;
Do NOT ask questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;how do I make python code that does this?&amp;quot;, which simply solves a problem for you - likely in a way that is not intended in the course progression, and you do not really understand, because it is either outside or too early in the curriculum.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22101/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22101/22161 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22101/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme 2023]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Exceptions_and_Bug_Handling&amp;diff=63</id>
		<title>Exceptions and Bug Handling</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Exceptions_and_Bug_Handling&amp;diff=63"/>
		<updated>2024-09-25T10:08:12Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Required course material for the lesson */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python Input-Output]]&lt;br /&gt;
|Next: [[Stateful Parsing]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_07-Exceptions.ppt Exceptions and Bug Handling]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d230fcd7-c06c-414e-a14d-af27012e22f6 Exceptions]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d2136eb3-c9cb-414d-a0dc-af27012daa40 Exceptions example code]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=149168ad-61c5-4ad6-bad0-af27012e0077 Formatting data]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=08e7ed65-afe3-4f53-9d21-af27012de2bf Comparing many values]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=1255c184-8256-41d9-afc0-af27012dc955 Finding errors in your program]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=5e77fe45-be78-4ecf-a5f5-b1f600a24a62 Playing the guessing game], detecting lies and endings.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Exceptions]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=acd48c9a-cacb-4832-9184-af27012c7021 Live coding]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
How to structure your code in distinct parts.&amp;lt;br&amp;gt;&lt;br /&gt;
Finding bugs in your program, using &#039;&#039;exceptions&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Formatting strings using the methods &#039;&#039;&#039;format&#039;&#039;&#039;, &#039;&#039;&#039;upper&#039;&#039;&#039; and &#039;&#039;&#039;lower&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# In the file &#039;&#039;dna.fsa&#039;&#039; is some DNA. Construct a program that finds possible translation starts :-)&amp;lt;br&amp;gt;All proteins start with the amino acid methionine (at least when translating, Met might be removed in later processing states). Methionine is coded with ATG. The exercise is therefore; find the position of all ATG&#039;s in the sequence. The first position is 83 as humans count. &amp;lt;br&amp;gt;In some organisms different start codons are possible. If you really want to, you can make the program handle those cases too.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;Connecting to the previous exercise; Assuming that the first Met at position 83 is translation start, find the corresponding translation stop (which is the first one in frame). Stop codon is coded by TAA, TAG, or TGA. Remember that the stop codon has to be in the same reading frame as ATG. Notice: There are two ways to solving this exercise. The primitive way is to start at the position given. The more general and better way is to find the first ATG and then find the corresponding stop codon.&amp;lt;/font&amp;gt;&lt;br /&gt;
# &amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;Make a program that asks for an organism, like &#039;HUMAN&#039; or &#039;RAT&#039;. The program should then count the number of lines/times a SwissProt identifier in the file &#039;&#039;orphans.sp&#039;&#039; is present with said organism, ie. PARG_HUMAN and LUM_HUMAN are the two first for HUMAN. Hint: you should probably think twice in this exercise.&amp;lt;/font&amp;gt;&lt;br /&gt;
# Count the ATCG&#039;s in the sequence in &#039;&#039;dna.fsa&#039;&#039;. Display the percentage of ATCG&#039;s with 2 digits after the dot. Make  it look really structured. Just to be exceedingly clear; the percentage of A&#039;s is 100*(NumberOfA/LengthOfSequence).&lt;br /&gt;
# Playing time again. Make the guessing program from last week count how many attempts it needed to guess the number and print it when done guessing. It must be able to detect if you lie (and say so, of course). Also, if you haven&#039;t done it before, make the program guess in the fewest possible guesses (an example of &#039;binary search&#039;). This is what most people naturally do by themselves when they play the game. You &#039;just&#039; have to do it in the program. There is a system, a method - find it.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* In a file you make yourself are numbers and words with one number/word on each line. Now make a program that reads the file and sums the numbers and displays the result. The words are ignored.&lt;br /&gt;
* In the file &#039;&#039;mixedlines.txt&#039;&#039; how many 4 letter words exists? A word is here defined as consecutive visible characters, i.e. &amp;quot;12&amp;quot;,  &amp;quot;ipsum.&amp;quot; are both words.&lt;br /&gt;
* Write a program that asks for an integer, and then determines if the number was a prime number or not.&lt;br /&gt;
* Write a program that prints a &amp;quot;bulls-eye&amp;quot; to the screen using characters like; &#039;.&#039;, &#039;+&#039;, &#039;*&#039;, &#039;#&#039;, etc.&amp;lt;br&amp;gt;You have to import the math library, in order to access the squareroot (sqrt), sine (sin), cosine (cos), and so forth functions. The square root of x is gotten like math.sqrt(x). I only used: for, if, elif, print, +, -, /, **, int, sqrt for this 40x40 example.&amp;lt;br&amp;gt;Hint: Think of a grid where one point is the center of the eye/circle. The positions in the grid will use different chars, depending how far away they are from the center. You might get an oval shape - think about why.&amp;lt;br&amp;gt;[[File:BullsEye.png]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Pseudocode_and_Comments&amp;diff=62</id>
		<title>Pseudocode and Comments</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Pseudocode_and_Comments&amp;diff=62"/>
		<updated>2024-09-25T10:05:03Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Required course material for the lesson */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Simple File Reading]]&lt;br /&gt;
|Next: [[Python Input-Output]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_05-PseudoComments.ppt Pseudocode, comments and user interface]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=79ac24c4-603c-4a6e-9343-af2701292c8c The use of pseudocode and comments] &amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e2e3be56-6210-4e62-84d0-b1f600a3af21 Playing the guessing game], strategies and advice.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d5c0132e-cc4e-4e1a-bc99-af27012a777e Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/18/affordances-and-metaphors/ On User Interface 1], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/22/consistency-and-other-hobgoblins/ On User Interface 2], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/26/designing-for-people-who-have-better-things-to-do-with-their-lives/ On User Interface 3], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/05/09/the-process-of-designing-a-product/ Designing the software product], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
&#039;&#039;Pseudo code&#039;&#039;, which is &amp;quot;pretend&amp;quot; code, that tries to look like a program.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;Comments&#039;&#039;, which is essential for understanding, maintenance, explanation, memory and other good stuff.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;User interface&#039;&#039;, how the program should interact with the user.&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
In all these exercises, start with writing pseudo code first and the program after.&lt;br /&gt;
&amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;&lt;br /&gt;
# Make a program that asks for two numbers (integers), and calculates the mean (average) of those numbers. The mean must be converted to an integer. Displays result along with input numbers. Make sure what is displayed is explained well.&lt;br /&gt;
# Write a program that asks for a file name and then open the file and count the number of empty lines and non-empty lines in the file. Display the two counts. Test it on the &#039;&#039;mixedlines.txt&#039;&#039; file.&amp;lt;br&amp;gt;Warning: Just because you can not see it, it does not mean it does not exists. Invisible characters have long been a curse of programmers. So do not make them yourself.&lt;br /&gt;
# Returning to last weeks exercise 4, where you had to ask for a file name and you program would then calculate the average of the numbers in the file. Do the same this time, except you have to continue to ask for file names and calculate the average until you enter nothing - no file name. Test on the same files as last time.&lt;br /&gt;
# Now for some playing. Make a program that guesses a number between 1 and 10 that you think of. It should make a guess, and you shall answer yes (if correctly guessed), higher (if the number you think of is higher than the guess) or lower (if the number you think of is lower than the guess). The program ends when the number is guessed correctly, otherwise it tries again. It is NOT considered OK to guess at a number more than once, i.e. no repeats. It is counterproductive to try to make this random guessing. Also think about how simple you can make this and still fulfill the wording of the exercises. Just don&#039;t run with the first idea you get. Don&#039;t embellish with additional functionality - it will just get difficult and we save that for later. Just to be clear - the number you think of must nowhere be in the program.&lt;br /&gt;
# Make a program that asks for a positive integer. Then it should print the same number of lines. On the first line there must be one &#039;&#039;&#039;#&#039;&#039;&#039;, second line two &#039;&#039;&#039;#&#039;&#039;&#039;, third line three &#039;&#039;&#039;#&#039;&#039;&#039;, and so forth. Do not enter too high a number or you will regret it. This will give the shape of a triangle.&lt;br /&gt;
# Let&#039;s play with shapes for a bit. Make programs that prints at least two of these shapes, one program per shape. It does not have to match my shapes exactly. Hint; think of printing one char at a time in a grid. That means one each line one char is printed at a time. You have to decide what to print based on the line and position in the line of the char.&amp;lt;br&amp;gt;[[File:shapes.png|800px]]&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Ask for a filename. Open the file and read and display the lines in a loop. However, if the line is empty, do not display it. Try on &#039;&#039;mixedlines.txt&#039;&#039;.&lt;br /&gt;
* Ask for a number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good. Open the file and count how many numbers are lower than your input number. Display the result.&lt;br /&gt;
* Ask for a number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good. Open the file and read the number on the lines. Compute two sums; the sum of numbers higher than your input number and the sum of numbers lower than your input number. Display the result.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Pseudocode_and_Comments&amp;diff=61</id>
		<title>Pseudocode and Comments</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Pseudocode_and_Comments&amp;diff=61"/>
		<updated>2024-09-25T10:00:24Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Required course material for the lesson */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Simple File Reading]]&lt;br /&gt;
|Next: [[Python Input-Output]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_05-PseudoComments.ppt Pseudocode, comments and user interface]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=79ac24c4-603c-4a6e-9343-af2701292c8c The use of pseudocode and comments] &amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=5e77fe45-be78-4ecf-a5f5-b1f600a24a62 Playing the guessing game], strategies and advice.&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=d5c0132e-cc4e-4e1a-bc99-af27012a777e Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/18/affordances-and-metaphors/ On User Interface 1], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/22/consistency-and-other-hobgoblins/ On User Interface 2], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/04/26/designing-for-people-who-have-better-things-to-do-with-their-lives/ On User Interface 3], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
Blog: [https://www.joelonsoftware.com/2000/05/09/the-process-of-designing-a-product/ Designing the software product], by the founder of StackExchange.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
&#039;&#039;Pseudo code&#039;&#039;, which is &amp;quot;pretend&amp;quot; code, that tries to look like a program.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;Comments&#039;&#039;, which is essential for understanding, maintenance, explanation, memory and other good stuff.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;User interface&#039;&#039;, how the program should interact with the user.&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
In all these exercises, start with writing pseudo code first and the program after.&lt;br /&gt;
&amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;&lt;br /&gt;
# Make a program that asks for two numbers (integers), and calculates the mean (average) of those numbers. The mean must be converted to an integer. Displays result along with input numbers. Make sure what is displayed is explained well.&lt;br /&gt;
# Write a program that asks for a file name and then open the file and count the number of empty lines and non-empty lines in the file. Display the two counts. Test it on the &#039;&#039;mixedlines.txt&#039;&#039; file.&amp;lt;br&amp;gt;Warning: Just because you can not see it, it does not mean it does not exists. Invisible characters have long been a curse of programmers. So do not make them yourself.&lt;br /&gt;
# Returning to last weeks exercise 4, where you had to ask for a file name and you program would then calculate the average of the numbers in the file. Do the same this time, except you have to continue to ask for file names and calculate the average until you enter nothing - no file name. Test on the same files as last time.&lt;br /&gt;
# Now for some playing. Make a program that guesses a number between 1 and 10 that you think of. It should make a guess, and you shall answer yes (if correctly guessed), higher (if the number you think of is higher than the guess) or lower (if the number you think of is lower than the guess). The program ends when the number is guessed correctly, otherwise it tries again. It is NOT considered OK to guess at a number more than once, i.e. no repeats. It is counterproductive to try to make this random guessing. Also think about how simple you can make this and still fulfill the wording of the exercises. Just don&#039;t run with the first idea you get. Don&#039;t embellish with additional functionality - it will just get difficult and we save that for later. Just to be clear - the number you think of must nowhere be in the program.&lt;br /&gt;
# Make a program that asks for a positive integer. Then it should print the same number of lines. On the first line there must be one &#039;&#039;&#039;#&#039;&#039;&#039;, second line two &#039;&#039;&#039;#&#039;&#039;&#039;, third line three &#039;&#039;&#039;#&#039;&#039;&#039;, and so forth. Do not enter too high a number or you will regret it. This will give the shape of a triangle.&lt;br /&gt;
# Let&#039;s play with shapes for a bit. Make programs that prints at least two of these shapes, one program per shape. It does not have to match my shapes exactly. Hint; think of printing one char at a time in a grid. That means one each line one char is printed at a time. You have to decide what to print based on the line and position in the line of the char.&amp;lt;br&amp;gt;[[File:shapes.png|800px]]&lt;br /&gt;
&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Ask for a filename. Open the file and read and display the lines in a loop. However, if the line is empty, do not display it. Try on &#039;&#039;mixedlines.txt&#039;&#039;.&lt;br /&gt;
* Ask for a number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good. Open the file and count how many numbers are lower than your input number. Display the result.&lt;br /&gt;
* Ask for a number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good. Open the file and read the number on the lines. Compute two sums; the sum of numbers higher than your input number and the sum of numbers lower than your input number. Display the result.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Programme&amp;diff=60</id>
		<title>Programme</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Programme&amp;diff=60"/>
		<updated>2024-09-24T10:50:32Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 03/09 Lesson 1: [[Using Jupyter Notebook]]&lt;br /&gt;
* 10/09 Lesson 2: [[Python Basics]]&lt;br /&gt;
* 17/09 Lesson 3: [[Simple File Reading]]&lt;br /&gt;
* 24/09 Lesson 4: [[Pseudocode and Comments]]&lt;br /&gt;
* 01/10 Lesson 5: [[Python Input-Output]]&lt;br /&gt;
* 08/10 Lesson 6: [[Exceptions and Bug Handling]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 22/10 Lesson 7 [[Stateful Parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 29/10 Lesson 8: [[Lists/Sequences]]&lt;br /&gt;
* 05/11 Lesson 9: [[More with Lists]]&lt;br /&gt;
* 12/11 Lesson 10: [[Simple Pattern Matching]] &lt;br /&gt;
* 19/11 Lesson 11: [[Sets]]&lt;br /&gt;
* 26/11 Lesson 12: [[Dictionaries]]&lt;br /&gt;
* 03/12 Lesson 13: [[How to Python]] - The mistakes we see&lt;br /&gt;
* 12/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Simple_File_Reading&amp;diff=59</id>
		<title>Simple File Reading</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Simple_File_Reading&amp;diff=59"/>
		<updated>2024-09-17T08:18:11Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python Basics]]&lt;br /&gt;
|Next: [[Pseudocode and Comments]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_04-FileReading.ppt Simple File Reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e51d5f37-84e5-46d4-8252-af270129a697 Simple file reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=def721bf-4e23-407c-9a5b-af2701298919 Objects, the concept. Some examples]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=18b01d1b-91b8-4e22-9303-af27012967ce Loop control, pass statement]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=07d50a0f-d574-444a-9cc9-af27012947c8 Boolean Logic, short-circuit evaluation ]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
&#039;&#039;with&#039;&#039; statement, just a simple use of it.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;open&#039;&#039; function for opening files for access. Filehandles.&amp;lt;br&amp;gt;&lt;br /&gt;
Built-in values; &#039;&#039;True&#039;&#039;, &#039;&#039;False&#039;&#039; and &#039;&#039;None&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Loop control with &#039;&#039;continue&#039;&#039; and &#039;&#039;break&#039;&#039; and how NOT to use them.&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Write a program that reads the file &#039;&#039;ex1.acc&#039;&#039; and displays it on the screen. Display it &#039;&#039;&#039;correctly&#039;&#039;&#039; as it is, i.e. the OUTPUT of your print should look precisely like the original file. Hint: look at the lines.&lt;br /&gt;
# Make the program ask for a filename (the input file in the following exercises), and display the file on the screen.&lt;br /&gt;
# Construct a program that counts the number of lines in the input file, and displays the result. Try it with the file &#039;&#039;ex1.dat&#039;&#039;. There are 1675 lines.&lt;br /&gt;
# Now make a Python program that sums numbers from ONE input file and displays the sum of the numbers. I have created 3 input files with the columns from &#039;&#039;ex1.dat&#039;&#039;; &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039;. Use the 3 files as input ONE AT A TIME and see the sums. The sums are approx. Col 1; -904.4143, Col 2; 482.8410, Col 3; 292.05150 for the three columns.&lt;br /&gt;
# Based on the previous program, now make a new one that calculates the mean value of the columns. Create your own test file with some numbers (where you know what the result should be) and feed that to the program.&lt;br /&gt;
# Now make a program that counts the number of positive and negative numbers in an input file. Also count the zeroes in the column, if there are any. Display the result.&lt;br /&gt;
# Now make a program that finds the maximum number in a column. Display the result. This is quite tricky. Hint: &#039;&#039;&#039;None&#039;&#039;&#039; could be useful.&lt;br /&gt;
# Now make a program that finds the minimum number in a column and display the result.&lt;br /&gt;
# It begins to get trivial. Now make a program that does all of the above, that is; calculate the sum, the number of lines, the mean value, the number of positive, negative and zero numbers, the maximum and the minimum value. You can only read the file once. Display the all results clearly so there is no doubt about what you display.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Ask for some input - it could be a word or a number or a sentence. Then ask for a file name - any file will do, but &#039;&#039;mixedlines.txt&#039;&#039; or &#039;&#039;ex5.acc&#039;&#039; are good. Now read the file and determine if one (or more) of the lines in the file matches your input precisely. Display &amp;quot;Match&amp;quot; or &amp;quot;No  match&amp;quot; accordingly. Hint: A line from a file has a newline at the end, but using the &#039;&#039;&#039;input&#039;&#039;&#039; function does not result in this newline.&lt;br /&gt;
* For extra difficulty, do the same program once more, but this time, it should only say &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; once, no matter how many matches there are. Make your own test file, with lots of the same number or word. If you already solved this in above exercise - good for you.&lt;br /&gt;
* Ask for 2 integers. Now print the first 20 numbers of the [https://en.wikipedia.org/wiki/Fibonacci_number Fibonacci sequence] given by those numbers. If the input is 1 &amp;amp; 3, the output would be 1 3 4 7 11 18 29 47 etc.. The next number is the sum of the 2 previous.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Simple_File_Reading&amp;diff=58</id>
		<title>Simple File Reading</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Simple_File_Reading&amp;diff=58"/>
		<updated>2024-09-17T07:52:17Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python Basics]]&lt;br /&gt;
|Next: [[Pseudocode and Comments]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_04-FileReading.ppt Simple File Reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e51d5f37-84e5-46d4-8252-af270129a697 Simple file reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=def721bf-4e23-407c-9a5b-af2701298919 Objects, the concept. Some examples]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=18b01d1b-91b8-4e22-9303-af27012967ce Loop control, pass statement]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=07d50a0f-d574-444a-9cc9-af27012947c8 Boolean Logic, short-circuit evaluation ]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
&#039;&#039;with&#039;&#039; statement, just a simple use of it.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;open&#039;&#039; function for opening files for access. Filehandles.&amp;lt;br&amp;gt;&lt;br /&gt;
Built-in values; &#039;&#039;True&#039;&#039;, &#039;&#039;False&#039;&#039; and &#039;&#039;None&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Loop control with &#039;&#039;continue&#039;&#039; and &#039;&#039;break&#039;&#039; and how NOT to use them.&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Write a program that reads the file &#039;&#039;ex1.acc&#039;&#039; and displays it on the screen. Display it &#039;&#039;&#039;correctly&#039;&#039;&#039; as it is, i.e. the OUTPUT of your print should look precisely like the original file. Hint: look at the lines.&lt;br /&gt;
# Make the program ask for a filename (the input file in the following exercises), and display the file on the screen.&lt;br /&gt;
# Construct a program that counts the number of lines in the input file, and displays the result. Try it with the file &#039;&#039;ex1.dat&#039;&#039;. There are 1675 lines.&lt;br /&gt;
# Now make a Python program that sums numbers from a input file and displays the sum of the numbers. I have created 3 files with the columns from &#039;&#039;ex1.dat&#039;&#039;; &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039;. Use the 3 files as input and see the sums. The sums are approx. Col 1; -904.4143, Col 2; 482.8410, Col 3; 292.05150 for the three columns.&lt;br /&gt;
# Based on the previous program, now make a new one that calculates the mean value of the columns. Create your own test file with some numbers (where you know what the result should be) and feed that to the program.&lt;br /&gt;
# Now make a program that counts the number of positive and negative numbers in an input file. Also count the zeroes in the column, if there are any. Display the result.&lt;br /&gt;
# Now make a program that finds the maximum number in a column. Display the result. This is quite tricky. Hint: &#039;&#039;&#039;None&#039;&#039;&#039; could be useful.&lt;br /&gt;
# Now make a program that finds the minimum number in a column and display the result.&lt;br /&gt;
# It begins to get trivial. Now make a program that does all of the above, that is; calculate the sum, the number of lines, the mean value, the number of positive, negative and zero numbers, the maximum and the minimum value. You can only read the file once. Display the all results clearly so there is no doubt about what you display.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
* Ask for some input - it could be a word or a number or a sentence. Then ask for a file name - any file will do, but &#039;&#039;mixedlines.txt&#039;&#039; or &#039;&#039;ex5.acc&#039;&#039; are good. Now read the file and determine if one (or more) of the lines in the file matches your input precisely. Display &amp;quot;Match&amp;quot; or &amp;quot;No  match&amp;quot; accordingly. Hint: A line from a file has a newline at the end, but using the &#039;&#039;&#039;input&#039;&#039;&#039; function does not result in this newline.&lt;br /&gt;
* For extra difficulty, do the same program once more, but this time, it should only say &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; once, no matter how many matches there are. Make your own test file, with lots of the same number or word. If you already solved this in above exercise - good for you.&lt;br /&gt;
* Ask for 2 integers. Now print the first 20 numbers of the [https://en.wikipedia.org/wiki/Fibonacci_number Fibonacci sequence] given by those numbers. If the input is 1 &amp;amp; 3, the output would be 1 3 4 7 11 18 29 47 etc.. The next number is the sum of the 2 previous.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=57</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=57"/>
		<updated>2024-09-07T05:58:02Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Peer evaluation of exercises */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and you must have done at least 11 evaluations to participate in the exam.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do.&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading ahead and using not yet covered techniques in exercises - don&#039;t do it ==&lt;br /&gt;
Sometimes people read ahead in the text book or the net and discover some techniques, that makes solving the exercises much easier. You might have learned some python in other courses. While you should learn whatever you can, then there is a reason for why the exercises are as they are, and the learning material (powerpoint) is as it is. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
If you just use an advanced trick, then you are not learning to analyze or formulate strategies. You are simply not learning to work with what you have, and consequently you will be doing enormous harm to your future learning. &lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&lt;br /&gt;
Python is full of tricks, so it is rather tempting, but damaging to use them during the course. You will have plenty of opportunity later to do trick programming.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). Using the standard at DTU, you must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=56</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=How_the_course_is_conducted&amp;diff=56"/>
		<updated>2024-09-07T05:56:37Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Peer evaluation of exercises */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Tuesday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 6 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. Since you can only evaluate if you have handed in exercises, then you need to do those, too :-)&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a notebook in Jupyter for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises which are handed in after the solutions are published, are voided and will not count, no matter the reason for being late.&amp;lt;br&amp;gt;&lt;br /&gt;
You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time. You can only evaluate if you have uploaded solutions yourself and you must have done at least 11 evaluations to participate in the exam.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:red&amp;quot;&amp;gt;Warning:&amp;lt;/div&amp;gt; Once you have handed in your solution, then it CAN NOT be changed/improved/replaced with a new version, if you have been evaluated. This also includes evaluating yourself. The system is to blame - nothing I can do.&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, I will be asking many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reading ahead and using not yet covered techniques in exercises - don&#039;t do it ==&lt;br /&gt;
Sometimes people read ahead in the text book or the net and discover some techniques, that makes solving the exercises much easier. You might have learned some python in other courses. While you should learn whatever you can, then there is a reason for why the exercises are as they are, and the learning material (powerpoint) is as it is. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
If you just use an advanced trick, then you are not learning to analyze or formulate strategies. You are simply not learning to work with what you have, and consequently you will be doing enormous harm to your future learning. &lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&lt;br /&gt;
Python is full of tricks, so it is rather tempting, but damaging to use them during the course. You will have plenty of opportunity later to do trick programming.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There is usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). Using the standard at DTU, you must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Sets&amp;diff=55</id>
		<title>Sets</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22101/index.php?title=Sets&amp;diff=55"/>
		<updated>2024-08-30T18:57:35Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Required course material for the lesson */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Simple Pattern Matching]]&lt;br /&gt;
|Next: [[Dictionaries]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22101/22101_12-Sets.ppt Sets]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=e69a7b62-4f83-4b92-b254-af27012c464e Sets]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Sets, which are unordered data collections with no duplicates.&amp;lt;br&amp;gt;&lt;br /&gt;
* Methods relevant to sets:&lt;br /&gt;
** &#039;&#039;&#039;clear&#039;&#039;&#039;, clears a set&lt;br /&gt;
** &#039;&#039;&#039;add&#039;&#039;&#039;, adds and element to the set,&lt;br /&gt;
** &#039;&#039;&#039;update&#039;&#039;&#039;, adds several elements to the set, performance,&lt;br /&gt;
** &#039;&#039;&#039;remove&#039;&#039;&#039;, removes an element from the set, error if not present,&lt;br /&gt;
** &#039;&#039;&#039;discard&#039;&#039;&#039;, removes an element from the set, no error,&lt;br /&gt;
** &#039;&#039;&#039;in&#039;&#039;&#039;, determines if an element exist,&lt;br /&gt;
** mathematical set operations, intersection (&amp;amp;), union (|)&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
# Read the sequences in the file &#039;&#039;dna7.fsa&#039;&#039;. Find out which and how many of the 64 codons are &#039;&#039;&#039;not&#039;&#039;&#039; used somewhere in the sequences. Print the unused codons.&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;You have made a program (let&#039;s call it the X-program), which as input takes a file of accession numbers, &#039;&#039;start10.dat&#039;&#039; and produces some output, which is in &#039;&#039;res10.dat&#039;&#039;. Now you count the lines in your input file and your output file and you discover that the line numbers do not match. Horror - your program does not produce output for some input. Now the assignment is to discover which accession numbers did not produce output. This can be done in various ways, but now you have to use a set. Print the results.&amp;lt;/font&amp;gt;&lt;br /&gt;
# &amp;lt;font color=&amp;quot;#AA00FF&amp;quot;&amp;gt;In the file &#039;&#039;ex5.acc&#039;&#039; are a lot of accession numbers, where some are duplicates. We have earlier cleaned this file of duplicates. Let&#039;s do that again using a set. Make a program that reads the file once, finds the unique accession numbers and write them to the file &#039;&#039;uniq5.acc&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
# In the &#039;&#039;data1.gb&#039;&#039; file there are 6 references (to articles). Make a program that extracts all authors from the references, eliminates those that are duplicates and print the list of authors. You will notice that some authors seems to be the same person using different initials. You should only consider a person a duplicate if the name matches exactly. This should also work for the other Genbank entries: &#039;&#039;data2.gb&#039;&#039;, &#039;&#039;data3.gb&#039;&#039; &amp;amp; &#039;&#039;data4.gb&#039;&#039;.&amp;lt;br&amp;gt;Beware: there traps in this exercise, check your output properly.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;br /&gt;
A k-mer is a piece of sequence k units long. It can be both protein and DNA sequence. As an example I have this DNA sequence: GACTAC. It contains the following 4-mers: GACT, ACTA, CTAC.&lt;br /&gt;
* From a genbank file like &#039;&#039;data1-4.gb&#039;&#039; extract the DNA sequence (been there - done that). Now insert all 5-mers in the DNA sequence into a set. Compute the following numbers: how many did you insert in the set, how many are in the set, how many different 5-mers could there possibly be. Display. It seems like the two first numbers are the same, but this is not guaranteed to be true, why?&lt;br /&gt;
* Calculate the overlap of 5-mers between any two of the &#039;&#039;data1-4.gb&#039;&#039; files. Just ask for two filenames and calculate for these.&lt;br /&gt;
* Make a program that asks for a number (integer) then reads the &#039;&#039;dna7.fsa&#039;&#039; file (which contains insulin-like genes) and saves the entry selected by the number in &#039;&#039;selected.fsa&#039;&#039; and the rest of the entries into the file &#039;&#039;rest.fsa&#039;&#039;.&lt;br /&gt;
* Now that you can select a fasta entry, then read the &#039;&#039;selected.fsa&#039;&#039; and create 5-mers from the sequence. Now read the entries from &#039;&#039;rest.fsa&#039;&#039; and for every entry create the 5-mers from the sequence. Report which sequence in &#039;&#039;rest.fsa&#039;&#039; had the greatest overlap (and how much overlap) with the selected sequence. This must be the sequence that looks most like the selected one.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>