![]() ![]() Finally, the result will be the eighth digit (the check digit) and therefore the program should then output the final barcode. If the user wants to generate a barcode, the program must ask the user to input a seven digit number, then it must multiply the seven digits alternatively in order by 3 than 1, then it must add the outcomes together to get a sum, then it must subtract the sum from the nearest equal or higher multiple of 10. However, I am not really sure what to do next. So far, I have developed a menu which asks the user whether they want to generate or validate a barcode. Print("You have chosen to validate a barcode") Print("You have chosen to generate a barcode")ĭ1 = int(input("Please enter the first digit"))ĭ2 = int(input("Please enter the second digit"))ĭ3 = int(input("Please enter the third digit"))ĭ4 = int(input("Please enter the fourth digit"))ĭ5 = int(input("Please enter the fifth digit"))ĭ6 = int(input("Please enter the sixth digit"))ĭ7 = int(input("Please enter the seventh digit"))Īnykey=input("Enter anything to return to main menu") ![]() Selection=int(input("Enter choice: ")) #tells user to enter a choiceĮxcept ValueError: #if user enters a string, it will loop back Quit") #prints out 3 options for the user to select Anyway, here is all the code I have so far: def mainmenu(): In addition, prior to being set this assignment my class has had very little Python experience, and I am currently the very definition of a Python beginner. However, my teacher is very poor and he does not have a clue whatsoever so asking for help in class isn't really a valid option. I have been set a task in my Computing class that I have to develop a python program that generates and validates a GTIN-8 barcode. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |