Materials:– Portable Speakers– Sonic Pi Scratch’s ability to teach the foundations of coding to children and those with no prior experience with computers is one of his most notable features. It appeals to children in particular since it lets them to construct video games with which they may participate as part of their education. On […]
Python For loop
We continue with our tutorials showing you the For loop, we modify our previous code to request 3 times a number oddNumbersArray = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59] for i in range(3): inputNumber = input("Input a number between 1 and 60 ") try: intNumber = int(inputNumber) if intNumber <= 60 and intNumber >= 1: if intNumber in oddNumbersArray: print("Number […]
Python While loop
We continue with our tutorials by modifying a bit our previous example in order to use loops. Lets request the number until the user input a correct number. requestInput = True oddNumbersArray = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59] while requestInput: inputNumber = input("Input a number between 1 and 60 ") try: intNumber = int(inputNumber) if intNumber <= 60 and […]
Python basic commands
We start our Python tutorials with some basic commands to warm up, you can test it on the Test Python basic code page to see results. inputNumber = input("Input a number between 1 and 60 ") oddNumbersArray = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59] try: intNumber = int(inputNumber) if intNumber in oddNumbersArray: print("Number is odd ", intNumber) else: if intNumber […]