Magzter Gold (Sitewide Promotion)
Raspberry Pi Coding & Projects The Complete Manual (Digital)

Raspberry Pi Coding & Projects The Complete Manual (Digital)

1 Issue, Issue 6

Also available on
Zinio Unlimited logo
1-month free trial

Get unlimited access to this article, this issue, + back issues & 5,000+ other magazines.

Renews at just $8.99/month after trial.

Cancel anytime.
Learn more

Conditions and Loops

Conditions and loops are what makes a program interesting; they can be simple or rather complex. How you use them depends greatly on what the program is trying to achieve; they could be the number of lives left in a game or just displaying a countdown.
Conditions and Loops
TRUE CONDITIONS Keeping conditions simple to begin with makes learning to program a more enjoyable experience. Let’s start then by checking if something is TRUE, then doing something else if it isn’t. STEP 1 Let’s create a new Python program that will ask the user to input a word, then check it to see if it’s a four-letter word or not. Start with File > New File, and begin with the input variable: STEP 2 Now we can create a new variable, then use the len function and pass the word variable through it to get the total number of letters the user has just entered: STEP 3 Now you can use an if statement to check if the word_length variable is equal to four and print a friendly conformation…
You're reading a preview of
Raspberry Pi Coding & Projects The Complete Manual (Digital) - 1 Issue, Issue 6

DiscountMags is a licensed distributor (not a publisher) of the above content and Publication through Zinio LLC. Accordingly, we have no editorial control over the Publications. Any opinions, advice, statements, services, offers or other information or content expressed or made available by third parties, including those made in Publications offered on our website, are those of the respective author(s) or publisher(s) and not of DiscountMags. DiscountMags does not guarantee the accuracy, completeness, truthfulness, or usefulness of all or any portion of any publication or any services or offers made by third parties, nor will we be liable for any loss or damage caused by your reliance on information contained in any Publication, or your use of services offered, or your acceptance of any offers made through the Service or the Publications. For content removal requests, please contact Zinio.

© 1999 – 2025 DiscountMags.com All rights reserved.