Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bc = input("Geben Sie einen Barcode ein: ") #bc = Barcode
- def stringcheck():
- if len(bc) == 30: #tests if "bc" has 30 characters
- pass
- else:
- print("Error: Der Barcode hat keine 30 Zeichen!")
- if bc.isdecimal(): #tests if "bc" only has digits
- return True
- else:
- print("Fehlercode 1")
- def weightcheck():
- ng = int(bc[8:13]) #gives ng (=Bruttogewicht) the value of the index 9-13 of "bc"
- bg = int(bc[18:23]) #gives bg (=Bruttogewicht) the value of the index 19-23 of "bc"
- if ng > bg:
- print("Fehlercode 2")
- exit()
- else:
- return True
- if stringcheck() and weightcheck() is True:
- print("Fehlercode 0")
- else:
- pass
- stringcheck()
- weightcheck()
Add Comment
Please, Sign In to add comment