我知道如何使用roundup函数。 这就是我现在拥有的东西。 (这是整个程序。 ) #Step 1
打印(enterthefirstdigitofyourgtincode ) )。
digit_1=int(input ) )
打印(entertheseconddigit ) )
digit_2=int(input ) )
打印(enterthethirddigit ) )
digit_3=int(input ) )
打印(enterthefourthdigit ) )。
digit_4=int(input ) )
打印(enterthefifthdigit ) )。
digit_5=int(input ) )
打印(企业版) )。
digit_6=int(input ) )
打印(entertheseventhdigit ) )。
digit_7=int(input ) )
#Step 2
total_1=digit_1 * 3
total_2=digit_2 * 1
total_3=digit_3 * 3
total_4=digit_4 * 1
total_5=digit_5 * 3
total_6=digit_6 * 1
total_7=digit_7 * 3
#Step 3
final _ total=total _1total _2total _3total _4total _5total _6total _ 7
#Step 4
导入匹配
defroundup(final_total ) :
返回int (math.ceil (final _ total/10.0 ) ) 10
final _ total _2=round up (final _ total )
gin _ number=final _ total-final _ total _ 2
print(yourgtinnumberis ),GTIN_number ) )。
基本上,这是我程序的结尾,怎么计算GTIN数字? 那个程序无法计算正确的GTIN号码。 例如,数字3613296的最后一位(第八个)应该是6,但答案是-6。
我希望你能理解我的意思。 请把这个拆开,说明一下。 因为我是初学者。 在
谢谢你! 在