106k views
0 votes
Which Python variable names are invalid?

a) 12MonthsTotal_Pay

b) TotalPay$

c) Total_January2019

d) JanuaryRateln%

User Ilj
by
4.9k points

2 Answers

5 votes

Answer:

(A) 12MonthsTotal_Pay (B) TotalPay$ and (D) JanuaryRateIn%

Explanation:

B and D feature symbols and signs, which aren't allowed in variable names of python. Variables cannot start with numbers, either, so A is invalid. C is the only right answer

User Jiang Bian
by
5.0k points
3 votes

Answer:

In the following question, Option(a), Option(b), and Option(d) is correct because in Python programming language we not defined variable in these types.

Explanation:

a). 12MonthsTotal_Pay = 5

output:

SyntaxError: invalid syntax

Because variable is not start with numbers.

b). TotalPay$ = 7

output:

SyntaxError: invalid syntax

Because the variable is not supported any symbol.

d). JanuaryRateln%= 12

output:

SyntaxError: invalid syntax

Because the variable is not supported any sign and symbol.

User BWG
by
5.3k points