I don't know what an imput variable is. But presuming you meant input, the input variable is the independent variable. Show The output variable is the dependent variable. Remember, the output depends upon the input. John \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)
Hypothes.is tag: s20iostpy02ualr Download Assignment F2020py02 Learning ObjectivesStudents will be able to: Content:
Process:
Note This activity asks you to execute lines of Python Code. Start the Thonny IDE. In the Shell window you can type individual command lines, or in the editor window you can type a whole program and run it. Figure \(\PageIndex{1}\): Thonny GUI showing the three most common displays you will be using.
Model 1: Input in PythonInput, one of the four main operations of a computer, is performed using an input statement in Python. The prompt that appears on the screen to tell the user what to enter is included as a string literal in the parentheses of the input statement. Input() and print() are known as functions in python. In python 3 functions are followed by ( ), and inside the () are FlowchartPython Program
# Programmer: Monty Python # Date: Sometime in the past # Description: A program that introduces variables name = input("What is your name? ") print("Your name is", name) Critical Thinking Questions:
a. What happens when this line of code is executed? b. What appears in the console window when this line of code is executed? FYI: The words that appear on the screen to tell the user what to enter is known as a prompt. c. Where is the data stored when the user enters something after the prompt and presses the Enter button? 4. Notice that the word name is in both lines of code. Is the string literal "name" printed when the second line of Python code is executed? What is printed?
Model 2: Variables in PythonThe word name in the Python code is a variable – the value of the variable name is given to a memory location used to store data.
name = input("What is your name? ") print("Your name is",name) name = input("What is your name? ") print("Your name is",name) 5. What happens when you execute each of the following lines of Python code? Hint, edit the above code, don't rewrite from scratch. The idea here is to figure out how a variable name can be written (there are rules for naming variables and you need to try and figure out some of the basic ones, so try each of these in turn) a. name? = input("What is your name?") b. your name = input("What is your name?") c. 1st_name = input("What is your name?") d. from = input("Where were you born?") 6. Examine the errors that occurred when executing the lines of code in question 5. In 5d did you notice how the word from (like print and input above) became purple? In Thonny (it is a function), so if you are typing a word and it turns purple, that word is a function, and you can't use it as a variable name. Then examine the following lines of valid code. name2 = input("What is your name?") your_name = input("What is your name?") yourName = input("What is your name?") What are the rules for creating a valid variable name?
7. Are the following variable names valid? Are they good names? Why or why not? Variable nameComments about variable nameprice costoffirstitem Ic firstName
Note: Printing multiple items and concatenation You can concatenate two strings literals, two string variables or a string literal and a string variable using the "+" symbol. The strings can be string literals or a variable containing string literals. To print multiple values without being concerned whether they are strings, you can use a "," comma. 8. Predict the output and execute the following lines of code. name = input("What is your name? ") print("Your name is",Name)
a. Is the output what you would expect? Why or why not? b. How can you alter the code so that it functions properly? WORK9. Use the following set of Python statements to answer the questions below. f Exercise \(\PageIndex{1}\) Predict the results of each print statement and then using either the Thonny python shell on your computer or the Binder access to the LibreText Jupyter Hub validate your answers (you can cut and paste each question into the IDE/binder, the first one is already loaded) print("Your name is", "Pat.") print('Your name is', "Pat.") print("Your name is" + "Pat.") print("Your name is", 20) print("Your name is" + 20)
7 Answer b10 Answer c2+5 Answer dAge: 7 Answer eAge: 7 years f print("Your name is", "Pat.") print('Your name is', "Pat.") print("Your name is" + "Pat.") print("Your name is", 20) print("Your name is" + 20) a. State the output for each of line of code. 10. Execute the following program: name = input("Enter name:") ID=input("Enter your student ID number: ") course = input("Enter your course number: ") print(name +"'s ID is" + ID + "\nand is enrolled in " + course)
a. State what is displayed on the screen when you executed the program.
Application Questions: Use the Thonny IDE to check your work 1. State a good variable name for an employee’s ID number. 2. Provide an example of a string literal. 3. Provide an example of a numeric literal. 4. Write a line of Python code that prompts the user for the name of their favorite ice cream and stores it in a valid variable name.
Individual Homework ActivityWrite a Python program that prompts the user for a name of an element and its atomic number. See a sample output for Hydrogen below: Be sure your output has the same punctuation as the above output.
(8 pts)
(2 pts)Make 1 annotation on any open access webpage dealing with the the use of Thonny. Post them to the 2020sIOST group and tag them s20iostpy02ualr. Remember the tags are case sensitive, and everything is lower case.
Copyright StatementThis work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, this material is a modification by Ehren Bucholtz and Robert Belford of CS-POGIL content, with the original material developed by Lisa Olivieri, which is available here. This page titled 2.2: Input and Variables in Python is shared under a not declared license and was authored, remixed, and/or curated by Robert Belford. Which variable is the input variable?The independent variable (x) represents the input values for a given function. In an experiment, the independent variables are controlled during the experiment. The dependent variable (y) represents the outputs of the function.
What is the input value called?The set of input values is called the domain, and the set of output values is called the range.
Why is the input a variable?Here's how to understand those terms: A variable is an input variable if its Input property is Yes. Its value can be input from an external source, such as an Architect call flow. A variable whose Output property is Yes is an output variable.
What is another name for input variable in math?The Definition of an Input in Math
The input is sometimes called the independent variable. Functions are often expressed in function notation. In function notation, the equation used earlier as an example of a function, y = x + 5 y = x + 5 , would be expressed as f(x) = x + 5 f ( x ) = x + 5 .
|