-
Notifications
You must be signed in to change notification settings - Fork 3
feb15.py #3
Description
Question one
10 Example of accepted Variable names.
- name
- my_Var
- _Name_School
- MYNAME
- Number2
- mySchool
- 28
- -36
- 3.9
- 5+7
Question two
5 Example of not accepted Variable names.
- 2myname
- My-school
- My var
- <name
-
value
Question three
5 Example of not recommended Variable names
Rules for Python variables:
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
• Variable names are case-sensitive (age, Age and AGE are three different variables)
String
Name
Class
Integer
20
-54
List
[1, 2, 3, 4, 5, 6, 7,]
[“man”, “book”, “usman”, “kabiru”]
Dictionary
{7: ‘name’, 2: ‘usman’}
{“name”: “Abba”, 1:[1, 2, 3, 4, 5,]}
Set
{“school”, “Name”, ”Class”, 1, 0.5, 23, -5, 4}
{“Hello”, (“wold”)}
Tuple
(“Apple, ”banana”, “Milk”)
(“abc”, 34, True, 27, “man”, “man”)