Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
51 views

Variables: When Programming It Is Often Necessary To Store A Value For Use Later On in The Program

This document discusses variables in programming and how they allow values to be stored and accessed later. It defines a variable as a labeled location in memory that can contain a value. Variables are like boxes with labels that can store information. The document also covers inputting numbers as variables and using int for whole numbers, float for decimals, and str to convert numbers to strings.

Uploaded by

armbennett
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Variables: When Programming It Is Often Necessary To Store A Value For Use Later On in The Program

This document discusses variables in programming and how they allow values to be stored and accessed later. It defines a variable as a labeled location in memory that can contain a value. Variables are like boxes with labels that can store information. The document also covers inputting numbers as variables and using int for whole numbers, float for decimals, and str to convert numbers to strings.

Uploaded by

armbennett
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Variables

When programming it is often necessary to store a value for use later


on in the program.
A variable is a label
given to a location in
memory containing a
value that can be
accessed or changed.
Think of a variable as a
box with a label that
you can store
information in.
Example
Start
End
Match the Python code to the correct part of the flowchart.
Create a Python program based on the code above and
save it as variables.py. Press F5 to run it.
Input Name
Display Hello
+ name
Inputting Numbers
When inputting numbers into variables you need to tell
Python what data type to expect.
We use int to tell Python we are going to enter an integer (whole
number). We use float when working with decimal places.
Create a new program using this code and save it as
numbers.py.
We use str to convert a number into a string.

You might also like