<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>userinput &amp;mdash; Paul Sutton</title>
    <link>https://paper.wf/paulsutton/tag:userinput</link>
    <description>Paul Sutton - personal blog </description>
    <pubDate>Thu, 07 May 2026 00:38:00 +0000</pubDate>
    <item>
      <title>Code Club – testing input</title>
      <link>https://paper.wf/paulsutton/code-club-testing-input</link>
      <description>&lt;![CDATA[Code Club – testing input &#xA;&#xA;Once you have code working nicely, it is a good idea to add in error checking so that when asking for user input,  what is put in to the program matches what is required. &#xA;&#xA;We can ask a user for a numerical value so we know how many times to repeat the loop.   How do we test for this. &#xA;&#xA;letter = rawinput(&#34;Enter your name &#34;)&#xA;i = letter.isalpha()&#xA;while i != True:&#xA;print(&#34;Input MUST use letters&#34;)&#xA;letter = rawinput(&#34;Name &#34;)&#xA;i = letter.isalpha()&#xA;print letter&#xA;&#xA;In this example,  the user is asked to enter their name,  this is stored and checked that is is actually a alphabetical character a-z or A-Z.  &#xA;&#xA;Tags&#xA;&#xA;#CodeClub,#Python.#Programming,#UserInput,#Testing]]&gt;</description>
      <content:encoded><![CDATA[<p>Code Club – testing input</p>

<p>Once you have code working nicely, it is a good idea to add in error checking so that when asking for user input,  what is put in to the program matches what is required.</p>

<p>We can ask a user for a numerical value so we know how many times to repeat the loop.   How do we test for this.</p>

<p>letter = raw<em>input(“Enter your name “)
i = letter.isalpha()
while i != True:
print(“Input MUST use letters”)
letter = raw</em>input(“Name “)
i = letter.isalpha()
print letter</p>

<p>In this example,  the user is asked to enter their name,  this is stored and checked that is is actually a alphabetical character a-z or A-Z.</p>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:CodeClub" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">CodeClub</span></a>,<a href="/paulsutton/tag:Python" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Python</span></a>.<a href="/paulsutton/tag:Programming" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Programming</span></a>,<a href="/paulsutton/tag:UserInput" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">UserInput</span></a>,<a href="/paulsutton/tag:Testing" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Testing</span></a></p>
]]></content:encoded>
      <guid>https://paper.wf/paulsutton/code-club-testing-input</guid>
      <pubDate>Sat, 19 Aug 2023 08:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>