Unit 5 Lesson 6: User Input and Strings CS Principles
Unit 5 Lesson 6: User Input and Strings Objectives Students will be able to: Identify strings as a unique data type which contains a sequence of ASCII characters. Describe characteristics of the string data type. Accept string input in a program. Manipulate user-generated string input to generate dynamic output
User Input and Strings Strings are a feature of essentially every programming language, and they allow for variable-length pieces of text to be represented, stored, and manipulated. While a single string can be stored in a variable, it is worth noting that a string will typically use much more memory than a number. Numbers are typically stored in fixed-width 8-, 16-, 32-, or 64-bit chunks. ASCII characters require a single byte and so a string of 100 characters, short by most standards, would require 800 bits in order to be stored in memory. While “typed” programming languages require you to declare the size and type of a variable before you use them, in more dynamic programming languages, including JavaScript, this memory management is abstracted away.
U5L6 Vocab Concatenate - to link together or join. Typically used when joining together text Strings in programming (e.g. "Hello, "+name) String - Any sequence of characters between quotation marks (ex: "hello", "42", "this is a string!").
Mad Libs Activity Guide Decide what the theme of your Mad Libs app will be, what text they will accept into your app, and how it will be incorporated into its output. The primary guidelines of the project (also included in the Activity Guide) are: The app should be a “how-to” Mad Libs (e.g., “How to take care of your pet ostrich”). Afterwards, you list steps with key components left open for user input. This is primarily to help students quickly conceive of ideas. There should be at least 3 steps in their instructions. Their app should accept at least 3 pieces of user input. Before moving into the rest of Code Studio, students should have a rough outline of their project.