Variable Names - Python

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

0 The 99 was replaced with the 0. Only the most recent value displays.

What will be displayed by the following program? my_value = 99 my_value = 0 print(my_value)

The value is val. Notice the quotes around the 'val' which makes it a string and not a variable.

What will the following code display? val = 99 print('The value is', 'val')

Legal (Yes it can begin with an underscore)

Is this a legal Python variable name? _Name

Legal (mixing upper and lower case is OK)

Is this a legal Python variable name? dayOfWeek

Legal (Underscore is allowed)

Is this a legal Python variable name? units_per_day

Invalid. The variable name comes first: amount=72

Is the following assignment statement valid or invalid? 72 = amount

No. Python is case sensitive and will have 2 different variables.

Is the variable name 'Sales' the same as 'sales'?

Illegal (Variable names cannot start with a digit)

Is this a legal Python variable name? 3dgraph

Legal (Python doesn't check spelling)

Is this a legal Python variable name? Juen1977

Illegal (Names may only contain letters, digits, or underscores)

Is this a legal Python variable name? Mixture#3

Illegal (Hyphens are not allowed)

Is this a legal Python variable name? Pay-rate


Ensembles d'études connexes

Incorrect NCLEX Questions Part 2

View Set

The Challenges of Starting a Business (Chap. 5)

View Set

Strategic Management ch. 9 Corporate Strategy: Strategic Alliances, Mergers and Acquisitions

View Set

Chapter 03: Developmental and Genetic Influences on Child Health Promotion Hockenberry: Wong's Essentials of Pediatric Nursing, 10th Edition

View Set

Chapter 60 - Spinal Cord and Peripheral Nerve Problems

View Set