Python Variables basics

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Variables are this, that have a name

are storage locations

t/f: variable names in python are NOT case sensitive

false: variable names in python ARE case sensitive

in this example the value of: apple is assigned to the variable called: fruit.

fruit = 'apple'

Variables are storage locations that have a this-

have a name

when choosing a variable name, pick something that is this

that represents the data the variable will hold.

to assign a value to a variable, use this sign

the equals sign

you can recall values assigned to a variable by this name

the variable name

t/f: by convention, variables are in all lower case letters, but it is not a requirement.

true

t/f: the variables 'Fruit' and 'fruit' are two distinct variables.

true

t/f: variables are name-value pairs

true

t/f: you can assign values to a variable and recall those values by the variable name

true

you can assign this or these to a variable

values

the format to assign a value to a variable, generally, is this:

variable_name = value

variable naming rules are these:

-> Variable names MUST start with a letter. ->They can contain numbers , but variable names CANNOT start with a number. ->You CAN also use the underscore ( _ ) character in variable names. ->You CANNOT use a hyphen (-), plus sign (+) and other various symbols in variable names.

t/f: you can NOT change the value of a variable

false: you CAN change the value of a variable by reassigning it.

Here are some examples of valid variable names:

first3letters = 'ABC' first_three_letters = 'ABC' firstThreeLetters = 'ABC'


Ensembles d'études connexes

HRM Chapter 15-Employee Rights and Responsibilities

View Set

Chapter 9 exam - Retirement plans

View Set

World History Chapter 18 - India

View Set

1.1 Ports and Protocols Questions

View Set

PrepU Chapter 39: Assessment and Management of Patients With Rheumatic Disorders

View Set