Friday, August 16, 2024

Intro to Python: Take a Peek!

LearnPython.Com has great beginner steps for learning logic (equations), syntax (grammar structure), and examples that are easy to follow!

LearnPython.Com Code Example Snippet

In this code snippet, there are a couple of things that are happening. 
1. variableName (what you want to call your result from the rest of the sentence and what the value returned shall be known as hereAfter).

  •         equals sign always represents assigning the value after it to the variableName

  •         there are dataTypes - something the memory of the computer needs to assign size for whatever you are working with. The best estimate you have makes the program run faster if at least amount. That is the "int" part. It means "integer" or number, whole number, typically. Not decimals - they'll probably roll that out later if they have a dataType for it. 
  • input is referring to the type of variableName this actually is.. its going to be something you ask the user to respond or interact with - in real time. The module we work with can also be found at www.w3Schools.com when researching programming language, references, code snippets to alter and use. Very convenient when learning the ropes. 
  • the last part of this first line is what you want your user to respond, the question. All of the 'oompf' of single quotation marks are necessary. It is designated print, automatically a string dataType (or words, letters, and sometimes certain characters are restricted from being assumed text words - because int is number, we have to convert those into text...), and yes the space is necessary because we are programming speed with short hand programming syntax/language as possible and every space has a value in the response time. Not to mention, understanding it as it can be returned to us in that print style of English grammar. 
The rest goes on to explain the if statement and the type of program it is as a whole. This asks the user for any number. The logic of it is in the if statements - you are giving it options to respond with what the user gives you. So, that means programming certain paths by giving it this or that (if statements are good for these types of decision making models). 

Program will do something like this:

Computer says: Provide a number: _  <<<<that little cursor will flash, waiting for a response...
You say: 3
Computer goes through the program you wrote (above) and determines that it cannot be divided (the % sign means division in Python) because it absolutely (the == sign means it has to be precisely that value) has value when divided by 2. So, the computer skips this step because it does not apply.

The computer goes to the next step. 

The else statement means, if its not this even number requirement then every answer outside of this HAS to mean its an odd number. Because that is what the program provides for answer. 

There could be technical defaults here but that is more than we need to explain (decimal - we haven't put up default statements, exception reports for what if the user goes outside of a whole number pathways to ask again).

Try repeating the steps and explaining each step to understand what it's asking you to do and how you solve it. 

Learning how to program in code is a difficult thing to do if you do not practice it daily. Strategizing mathematical concepts and putting them to use has to start young. Some of this is in our playground equipment we have for children on the reservation. I just seen Three Sisters was building a new playground and thought 'how boring' for those kids. We need something that projects their expectations and that means asking nerds, technical adults in our working fields, professionals - how would you like to play as a kid because it taught you something you needed throughout your life? Most people account sports to this, but not every kid can be an athlete unfortunately. 


Think about it. 

Join NEW-TRG and integrate it into your life so your children & grandchildren can benefit from it. 




No comments:

Post a Comment

Counting in Cultural Ways

 What in culture are we looking at to set us apart from the rest of the world? There was an article (blog post) with duolingo that really pr...