数字とアルファのリストが混在しています。
import random
def main():
list: ['1','2','3','4','5','6','7','a','b','c']
for count in range (1,5):
serial_no=("serial #: ", count)
totallist=0
from random import choice:
number=choice(list)
print(serial_no+'for the time: '+number)
if number.isdigit() and number<4:
totallist+=int(number) # want to add the first number >4
elif number.isdigit()and number>4:
totallist+=int(number)
elif number.isalpha():
list[9]=0
list[-1]=0
totallist=int(list[9])+int(list[-1]) #I could not add (error) (want to add alpha(as 0) and number after being alpha)
print(totallist)
main()
数<4の合計乱数に最初の乱数>4を追加する方法はありますか?
ありがとう