Repository navigation
Expand file tree
/
Copy pathMyExceptions.py
More file actions
executable file
·62 lines (40 loc) · 1.61 KB
/
Copy pathMyExceptions.py
File metadata and controls
executable file
·62 lines (40 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class invalid_brackets(Exception): #If no of brackets or order of brackets is wrong
def message(self):
a='error in giving brackets'
return a
class last_is_operator(Exception): #If the last no is missing
def message(self):
a='Last number is missing'
return a
class first_is_operator(Exception): #If first number is missing
def message(self):
a='first number is missing'
return a
class operator_side_by_side(Exception): #If there are any operators side by side except uninary operator
def message(self):
a='number is missing'
return a
class invalid_variable(Exception): #If there is any variable which is not declared
def message(self):
a='variable is not declared'
return a
class first_ch_is_digit(Exception): #If there is any variable which has ist charecter as a number
def message(self):
a='first character can\'t be a digit'
return a
class no_spaces(Exception): #If there is any variable which have spaces
def message(self):
a='no spaces allowed '
return a
class invalid_characters(Exception): #If there is any variable which other symbols except "_"
def message(self):
a='characters are invalid'
return a
class invalid_number(Exception): #If any number consists of a charecter
def message(self):
a='number is not valid'
return a
class keyword(Exception): #If user uses any key word ('exit()','clear all','pi','e','PI')as a variable
def message(self):
a='variable name can\'t be a keyword'
return a