<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Python on SourFox</title>
    <link>https://sourfox.khmersite.net/tags/python/</link>
    <description>Recent content in Python on SourFox</description>
    <image>
      <title>SourFox</title>
      <url>https://sourfox.khmersite.net/papermod-cover.png</url>
      <link>https://sourfox.khmersite.net/papermod-cover.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sat, 11 Nov 2023 19:08:38 +1100</lastBuildDate>
    <atom:link href="https://sourfox.khmersite.net/tags/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Assignment 5: Elements and Indices</title>
      <link>https://sourfox.khmersite.net/p/2023/11/assignment-5/</link>
      <pubDate>Sat, 11 Nov 2023 19:08:38 +1100</pubDate>
      <guid>https://sourfox.khmersite.net/p/2023/11/assignment-5/</guid>
      <description>&lt;p&gt;Today I had to do another assignment which is to create a python program which prints the elements of a list followed by their corresponding indices. Each element and its index must be on the same line seperated by a space. And if the list is empty, print &lt;strong&gt;&amp;ldquo;Empty List&amp;rdquo;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m going to make a list called num and put 1 to 4 inside.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;num = [1, 2, 3, 4]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then I&amp;rsquo;ll use the &lt;strong&gt;if&lt;/strong&gt; statement to do:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assignment 4: Checking if a list is empty</title>
      <link>https://sourfox.khmersite.net/p/2023/10/assignment-4/</link>
      <pubDate>Sun, 29 Oct 2023 18:42:54 +1100</pubDate>
      <guid>https://sourfox.khmersite.net/p/2023/10/assignment-4/</guid>
      <description>&lt;p&gt;I was given an assignment for the fourth time. My goal was to write a python program that checks if a list is empty or not. If the list is empty, then it&amp;rsquo;ll print &lt;strong&gt;empty&lt;/strong&gt;, if not, it&amp;rsquo;ll print &lt;strong&gt;not empty&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m going to start with an empty list.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;emp = []
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So that I can start the next step. I&amp;rsquo;m going to use&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;if statement&lt;/li&gt;
&lt;li&gt;len()&lt;/li&gt;
&lt;li&gt;else&lt;/li&gt;
&lt;li&gt;print()&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When using if, there must be a condition met. My condition is:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assignment 1: Using Length and String</title>
      <link>https://sourfox.khmersite.net/p/2023/10/assignment-1-using-length/</link>
      <pubDate>Sun, 15 Oct 2023 11:14:44 +1100</pubDate>
      <guid>https://sourfox.khmersite.net/p/2023/10/assignment-1-using-length/</guid>
      <description>&lt;p&gt;Today, I was given an assignment. My assignment wanted me to write a Python program that pints the length of a string.&lt;/p&gt;
&lt;p&gt;This is what I had to print out:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;The length of &amp;#34;&amp;#34; is 0.
The length of &amp;#34;H&amp;#34; is 1.
The length of &amp;#34;Hello&amp;#34; is 5.
The length of &amp;#34;Amazing&amp;#34; is 7.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To do this, I have a plan in my mind which is:&lt;/p&gt;
&lt;p&gt;Step 1. Find out what I&amp;rsquo;m going to use.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assignment 2: Python Using Lists and While-Loop</title>
      <link>https://sourfox.khmersite.net/p/2023/10/assignment-2-python-using-lists-while-loop/</link>
      <pubDate>Sat, 07 Oct 2023 12:43:22 +1100</pubDate>
      <guid>https://sourfox.khmersite.net/p/2023/10/assignment-2-python-using-lists-while-loop/</guid>
      <description>&lt;p&gt;I had an assignment that I was given for Python. What I have to do is to write a program in Python that asks a user to enter their favourite fruit, store each fruit in a list. At the end of the program, print out the total number of fruits, and also print all the fruits.&lt;/p&gt;
&lt;p&gt;This is what I&amp;rsquo;m expected:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;What is your favourite fruit? Banana (the fruit user put)
What is your favourite fruit? Apple  (the fruit user put)
What is your favourite fruit? Orange  (the fruit user put)
What is your favourite fruit? (empty) (the user didn&amp;#39;t write anything)

You have 3 fruits in the basket: Banana, Apple, and Orange.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So how do I do this?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Display Items in Python List</title>
      <link>https://sourfox.khmersite.net/p/2023/10/display-items-in-python-list/</link>
      <pubDate>Mon, 02 Oct 2023 16:44:02 +1100</pubDate>
      <guid>https://sourfox.khmersite.net/p/2023/10/display-items-in-python-list/</guid>
      <description>&lt;p&gt;Today, I was asked to write a small python code to print out all items in a list with comma seperated. The last item would end the with a &amp;lsquo;dot&amp;rsquo;, or full stop.&lt;/p&gt;
&lt;p&gt;For example, here is a list of sports:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;sports&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;basketball&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;soccer&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;netball&amp;#39;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And I was asked to print out the expected output:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;My&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;favourite&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sports&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;are&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;basketball&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;soccer&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;netball&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But how do I do this? Today, I&amp;rsquo;ll be showing you how to show the expected output using &lt;strong&gt;join&lt;/strong&gt; and without join.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
