Computer Science, asked by ananaya52, 10 months ago

iidentify invalid variables from the following and explain why:
group,if,int,total marks,!_volume,tag@,9a,abc,S.I,total_marks

Answers

Answered by Equestriadash
8

group, if, int, totalmarks, !_volume, tag@, 9a, abc, S.I, total_marks

Amongest them, these are the invalid variables:

1. if

Reason: 'if' is a Keyword in Python. Keywords cannot be used as variables.

2. !_volume

Reason: It contains a special character. Variables cannot consist of special characters other than an underscore (_).

3. tag@

Reason: Same as above, contains a special character.

4. 9a

Reason: It starts with a number. Variables cannot start with numbers.

5. S.I

Reason: It contains a special character.

Variables are reserved memory locations used for storing values.

Conditions for identifying a variable:

  • They identify the name of a entity when asked.
  • Can consist of letters, numbers and underscores; no other special character can be used.
  • They aren't case sensitive.
  • They can't start with a number.
Similar questions