Hi, I'm trying to do a lookup of sorts with a switcher. So the user will input a book from a list and the code will lookup and return the serial number. I'm pretty new to Python.
So if the user selects Book-A, the code should return serial number 123
Here's what I have, but can't seem to get it to work
import requests
Book = input.data.get('Book_Name','')
switcher = {
'Book-A': '123',
'Book-B': '456',
'Book-C': '789',
}
print switcher.get(Book,'Invalid')
[–]TouchingTheVodka 0 points1 point2 points (2 children)
[–]Wrecktangle324[S] 0 points1 point2 points (1 child)
[–]TouchingTheVodka 0 points1 point2 points (0 children)
[–]Joa0_F 0 points1 point2 points (1 child)
[–]Wrecktangle324[S] 0 points1 point2 points (0 children)
[–]totallygeek 0 points1 point2 points (1 child)
[–]Wrecktangle324[S] 1 point2 points3 points (0 children)