-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputHandler.py
35 lines (27 loc) · 1.09 KB
/
inputHandler.py
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
class InputHandler:
def takeAlienDetails(alien):
alien.codeName = input("Code name : ")
alien.bloodColor = input("Blood Color: ")
while True:
try:
alien.numberOfAntennas = int(input("Number of Antennas: "))
alien.numberOfLegs = int(input("Number of Legs: "))
break
except Exception as e:
print("Invalid Input : Integer Required")
print("\nTry Again\n")
continue
alien.homePlanet = input("Home Planet: ")
return alien
def enquireRequiredFormat(formats_available ):
print("To which format would like to export?")
for key in formats_available:
print (key, ". ", formats_available[key][0])
try:
to_format = int(input())
except Exception as e:
print ("Error in input: ", e)
if to_format > len(formats_available):
print("\n****Wrong Selection***\n")
sys.exit(0)
return to_format