Lexington Public Library | Reading is Just the Beginning ...
How to Speak Basic ComputerA Regular Person’s Introduction to CodingFun Fact: A Microsoft Word document that contains only the word “Test” actually has over 10 pages of XML (Extensible Markup Language) code telling it exactly how to look. A simple 15-page document, without pictures, can have upward of 100 pages of code lurking invisibly behind it.Thankfully, not everything in coding is that complicated. Or that longwinded.But what is computer code? It is, at its most basic, a foreign language that we can learn. Or, more accurately, a group of foreign languages. There are over 2000 computer or coding languages out there, though only a small percent of them are widely used. The most ancient of these computer languages consist purely of numeric codes and are sometimes referred to as machine languages. However, many of the more popular modern languages use a mix of regular English words, abbreviations and symbols. These are generally much easier to learn. Learning a new language isn’t just about memorizing lists of terms. You also need to consider the structure of how sentences and phrases are put together. Coding languages are no different in this. If you want the computer to be able to make sense of what you’re saying to it, the terms need to be placed in the order it expects and punctuated properly. Example Using HTML: <b> This is a sentence in bold. </b> = This is a sentence in bold. The text part tells the computer what we want it to say and the <b> tells it that we want it to be shown in bold. </b> Tells the computer we are finished with the bold effect and do not want it to continue past this point. Not all computer languages are created equal. As well as using different terms and “sentence structures”, different coding languages may also have very different intended purposes. With enough knowledge, time and effort you can sometimes use a coding language for more than its intended purpose, but that doesn’t mean a language designed for helping large machinery like fighter jets work is going to be equally good for building web pages. There can be a great deal of difference between a programming language like Python, and a markup language like HTML. Computer languages, deliberately created for use with machines, are extremely logical in their structure and the way they express ideas and instructions. Programming Languages are intended to describe and define tasks for a machine to carry out. They can be as simple as adding two numbers together or as complex as exactly how, when and where to change the position of an orbiting satellite. They are organized in a variety of overlapping subcategories. Markup Languages are intended for the presentation of text and related objects, allowing a person to give instructions on both the layout and style of text documents. A ‘tag’ <> </> structure is usually used to apply these instructions. Stylesheet Languages are intended for creating easily changed, standardized presentations for documents. Each stylesheet is a list of structured rules about how certain parts of the document should look. They are often used to modify documents written in markup languages. Getting Your Hands DirtyThe coding language we’ll be using here is Python3 which is one of the easier ones to read and write. If you wanted to build things with Python you would need to download it onto your computer, but you can try out the basics of it online without having to install anything. Websites like provide online environments for people to test and explore various computer languages. Starting Simple1. Go to the repl.it website and Select Python3 from the list of available languages. 2. Once you have selected a language you should see your screen split. The white half is where code is written and the black half is where we see the code run.3. In the white half type:question = “What is your name?”print (question)4. Click Run at the top of the white area and you will see the instructions you just typed carried out.5. But! Where there is a question, there should be an answer. Below the first two lines on the white side type:answer = input()print (“Hello, ” + answer + “.”)6. Click Run at the top of the white area. When the question comes up in the black area, type in your answer and press Enter on the keyboard. Getting More Complex1. You aren’t limited to just one question and answer though. The code you are writing can contain multiple questions and answers, just like a conversation with another person. 2. Between the period and the last closing ”) in your last line add the words:How are you today?3.Below that type: answer = input()print (“You feel ” + answer + “? Well, I hope the rest of your day is spectacular!”)4. Click Run and type in your responses on the black side when prompted. Adding Extras1. In the code we just ran you saw how answer was used to represent both pieces of user input, letting the second replace the first. If you want the computer to remember individual answers so that you can use them again later, then you need to provide unique names for each one. 2. Look back to your code and create a new line directly below the first answer = input(). Type: j = answer 3. Below your last line of code, type:print (“What can I do for you?”)answer = input()print (answer + “?”)print (“I’m sorry, ” + j + “. I’m afraid I can’t do that.”)4. Click Run if your final code looks like this:question = “What is your name?”print (question)answer = input()j = answerprint (“Hello, ” + answer + “. How are you today?”)answer = input()print (“You feel ” + answer + “? Well, I hope the rest of your day is spectacular!”)print (“What can I do for you?”)answer = input()print (answer + “?”)print (“I’m sorry, ” + j + “. I’m afraid I can’t do that.”)Changing Information Types1. Python can do different things with input depending on how the input is classified. Most input is automatically classified as str, meaning it is a group of specific, unchanging characters. If you want to be able to do math with your input, then you need to change its classification from str to int. Int stands for signed integer, this is the data type used for positive or negative whole numbers.2. Delete your existing code from the white half of the screen. Be sure to also use the Clear button above the black half to ensure we have a completely clean slate for our new piece of code. 3. In the white half of the screen type:print ("We can play a game! Please give me a number.")answer = input()a = answer * 111print ("If we multiply your number by 111 then we get " + a + “.”)4. Click Run and see what happens. 5. To correct the problem with your code, the data needs to be classified properly. Change the code to say:print ("We can play a game! Please give me a number.")answer = input()number = int (answer)a = number * 111b = str (a)print ("If we multiply your number by 111 then we get " + b + “.”)6. Click Run.But What Does It Mean?String -- a sequence of letter or number characters enclosed in ‘single’ or “double” quotes. Characters in quotes are displayed exactly as they are typed. Identifier -- a name used to identify a variable, function, class, module, string or other object. It can use letters, numbers, and underscores. Some words are reserved and cannot be used as identifiers. Identifiers are case sensitive. Beginning with a capital letter or underscore creates special types of identifiers. Keyword -- a word reserved for use as a piece of pre-defined code. They cannot be used as identifiers, constants or variables. Most versions of Python have 30 of these. Indentation -- is used to denote lines of code that are blocked or grouped together. This begins on the second line, under the keyword the block of code is associated with.Operator -- a special symbol that indicates a specific process to be carried out. There are 4 main types: Arithmetic, Boolean, Relational, and Bitwise. Some keywords are also operators, particularly Boolean (and, or, not) and Relational (is, is not) operators. Delimiter -- one or more symbols used to specify the boundary between regions of text or code.Function -- a block of organized, reusable code that is used to perform a single, related action. Python has over 60 built in for your convenience. Keywords and functions can overlap. Iterable -- An object, like a list or string, capable of returning its members or parts one at a time.Object -- anything that can be assigned to a variable or passed as an argument to a function. In Python that is basically everything.Python KeywordsandexecnotassertfinallyorbreakforpassclassfromprintcontinueglobalraisedefifreturndelimporttryelifinwhileelseiswithexceptlambdayieldPython OperatorsArithmeticRelationalBitwiseSymbolNameSymbolMeaningSymbolMeaning+Addition<strictly less than~bitwise negation-Subtraction<=less than or equal to^bitwise exclusive or*Multiplication>greater than&bitwise and/Division>=greater than or equal to|bitwise or//Floor division==equal to<<left shift%Modulo!= or <>not equal to>>right shiftPython Delimiters()[]{},:.`=;+=-=*=/=%=**=&=|=^=>>=<<=20 Basic Python FunctionsFunctionDescriptionabs()Return the absolute value of a pile()Compile the source into a code or AST object.dir()Return the list of names in the current local scope.help()Invoke the built-in help system.input()Reads a line from input, converts it to a string, and returns that.int()Convert a number or string to an integer.list()Return a list.locals()Update and return a dictionary representing the current local symbol table.max()Return the largest item in an iterable object.min()Return the smallest item in an iterable.next()Retrieve the next item from the iterator.open()Open file and return a corresponding file object.print()Print objects to the stream.range()Return an iterable sequence.repr()Return a string containing a printable representation of an object.setattr()Assigns the value to the attribute.sorted()Return a new sorted list.str()Return a str version of object.sum()Sums the items of an iterable from left to right and returns the total.type()Return the type of an object.What are some languages I could use for…General Programing(running servers, building programs, giving instructions to existing programs, etc.)CC#C++Objective-CPythonJavaPerlPHPJavaScriptLispRubySwiftBuilding WebsitesHTMLCSSJavaScriptActionScriptMaking Phone or Tablet AppsJavaSwiftObjective CLooking Under the Hood at How Machines ThinkCC++Assembly LanguageMachine CodeRetrieving or Manipulating InformationSQLJSONDatalogXQueryAnalyzing Data and Working with StatisticsPythonRJuliaJavaResourcesBuild and Test Code on the WebRepl.it -- and Use Code on your Own ComputerDownload Python -- Free Python Editors -- Code Help and TutorialsHTML Cheatsheet -- Python Tutorial -- Python Standard Library -- Python Language Reference -- Python -- Tutorial -- on Rails Tutorial -- Tutorial -- Tutorials C/C++ -- -- (Study is free, but ignore the certificates. They are not associated with the World Wide Web Consortium or any other authoritative body.)ArticlesFive Best Programming Languages for First-Time Learners -- 5 Programming Languages for Beginners -- Programming Language Should a Beginner Learn in 2016? -- ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- perceptual skills for use of an aac system van tatenhove
- documentation and coding for patient safety indicators
- lexington public library reading is just the beginning
- algorithms and programming
- answers to chapters 1 2 3 4 5 6 7 8 9 end of chapter
- python murray state university
- overview of the world languages standards curriclum
- elementary programming principles
- session 2 html coding basics
Related searches
- the beginning of the roman empire
- science in the beginning review
- online public library free ebooks
- genesis in the beginning worksheet
- why the public education system is failing
- the beginning synonym
- just the beginning synonym
- public library near me
- the beginning of us history
- and at the beginning of a sentence
- the beginning of mankind
- the beginning of man