<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sanni Aishat on Medium]]></title>
        <description><![CDATA[Stories by Sanni Aishat on Medium]]></description>
        <link>https://medium.com/@techiehijabi001?source=rss-2fb3567925fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cxNASxt2bUiMrcbS</url>
            <title>Stories by Sanni Aishat on Medium</title>
            <link>https://medium.com/@techiehijabi001?source=rss-2fb3567925fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 09:17:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@techiehijabi001/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Banana Beat Rock in My Python Game]]></title>
            <link>https://medium.com/@techiehijabi001/a-banana-beat-rock-in-my-python-game-359939f97e35?source=rss-2fb3567925fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/359939f97e35</guid>
            <category><![CDATA[python-for-beginners]]></category>
            <dc:creator><![CDATA[Sanni Aishat]]></dc:creator>
            <pubDate>Sun, 01 Nov 2026 11:39:59 GMT</pubDate>
            <atom:updated>2026-11-01T11:39:59.939Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*miLXWvBKHge1KOBTKW_Qeg.png" /></figure><p>I’ve known some Python for a while but never built anything. I just watched videos. So I’m making small projects now until I get good, and I’ll write about each one here, mistakes included.</p><p>First project: two-player rock paper scissors. Here’s my first version:</p><pre>def check_win(player, computer):<br>    print(f&quot;You chose {player} , computer chose {computer}&quot;)<br>    if player == computer :<br>      return &quot;It&#39;s a tie!&quot;<br>    elif player == &quot;rock&quot; :<br>       if computer == &quot;scissors&quot; :<br>          return &quot;Rock smashes scissors! You win!&quot;<br>       else :<br>          return &quot;paper covers rock! You loose!&quot;<br>    elif player == &quot;paper&quot;:<br>         if computer == &quot;rock&quot; :<br>            return &quot;paper covers rock! You Win!&quot;<br>         else:<br>            return &quot;scissors cuts paper! You Loose!&quot;<br>    elif player == &quot;scissors&quot;:<br>         if computer == &quot;rock&quot;:<br>            return &quot;rock smashes scissors! You Loose!&quot;<br>         else:<br>            return &quot;scissors cuts paper! You Win!&quot;<br>    else:<br>       return &quot;Kindly Replay!&quot;<br>response1 = input(&quot;Enter a choice (rock, paper, scissors): &quot;)<br>response2 = input(&quot;Enter a choice (rock, paper, scissors): &quot;)<br>game = check_win(response1, response2)<br>print(game)</pre><p>It worked, so I was happy. Then I tried to break it.</p><h3>What went wrong</h3><p>I typed rock for player one and banana for player two. The game said paper covers rock. A banana beat rock. My code only checks for scissors, and sends everything else to else, so anything that isn&#39;t scissors counted as paper.</p><p>Typing Rock with a capital R also failed, because Python sees Rock and rock as different words. And I spelt &quot;lose&quot; as &quot;loose&quot; in four places.</p><p>How I found these: [write what you actually did and when it clicked]</p><h3>The fix</h3><pre>choices = [&quot;rock&quot;, &quot;paper&quot;, &quot;scissors&quot;]</pre><pre># what each choice beats<br>beats = {<br>    &quot;rock&quot;: &quot;scissors&quot;,<br>    &quot;paper&quot;: &quot;rock&quot;,<br>    &quot;scissors&quot;: &quot;paper&quot;,<br>}</pre><pre>def check_win(player_one, player_two):<br>    if player_one not in choices or player_two not in choices:<br>        return &quot;Invalid choice. Kindly replay!&quot;<br>    print(f&quot;Player 1 chose {player_one}, Player 2 chose {player_two}&quot;)<br>    if player_one == player_two:<br>        return &quot;It&#39;s a tie!&quot;<br>    elif beats[player_one] == player_two:<br>        return f&quot;{player_one.capitalize()} beats {player_two}! Player 1 wins!&quot;<br>    else:<br>        return f&quot;{player_two.capitalize()} beats {player_one}! Player 2 wins!&quot;</pre><pre>player_one_choice = input(&quot;Player 1, enter a choice (rock, paper, scissors): &quot;).strip().lower()<br>player_two_choice = input(&quot;Player 2, enter a choice (rock, paper, scissors): &quot;).strip().lower()</pre><pre>result = check_win(player_one_choice, player_two_choice)<br>print(result)</pre><p>Now it cleans the input, rejects anything that isn’t rock, paper or scissors, and a small dictionary replaced all those nested if blocks.</p><h3>The terms, in plain words</h3><p><strong>Variable:</strong> a name that holds a value, like player_one_choice.</p><p><strong>String:</strong> text inside quotes.</p><p><strong>Function (</strong><strong>def):</strong> a named block of code you can reuse. Mine is check_win.</p><p><strong>return:</strong> sends the answer out of a function. I mixed it up with print at first. return hands back a value, print just shows it.</p><p><strong>f-string:</strong> a string with an f in front so you can put variables inside {}.</p><p><strong>if / </strong><strong>elif / </strong><strong>else:</strong> how code makes decisions.</p><p><strong>== vs </strong><strong>=:</strong> one = stores a value, two == checks if things are equal.</p><p><strong>List:</strong> a group of items in square brackets, like choices.</p><p><strong>Dictionary:</strong> key and value pairs. In beats, beats[&quot;rock&quot;] gives &quot;scissors&quot;.</p><p><strong>Method:</strong> a function attached to a value with a dot. .lower() makes text lowercase, .strip() removes extra spaces.</p><p><strong>in / </strong><strong>not in:</strong> checks if something is inside a list.</p><p><strong>Indentation:</strong> the spaces at the start of a line. Python uses them to know which code belongs where.</p><h3>What I took from this</h3><p>Code that runs isn’t always correct. Test it with silly input, because that’s where the bugs are.</p><p>If you try this yourself, tell me what you break. I’m learning too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=359939f97e35" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>