list1 = [] sizeNum = int(input("Please input the size of matrix: ")) for i in range(sizeNum): valueNum = int(input("Please input the value: ")) list1.append(valueNum) print(list1)
4月
14
4月
14
num = int(input("Please input a number: ")) for i in range(2, num): for j in range(2, i): if (i % j == 0): break if (i == j + 1): print(i)
4月
14
ans = 38 min = 0 max = 100 while(True): guess = int(input("Please input a number that between %d ~ %d : "%(min, max))) if (guess > ans): max = guess if (guess < ans): min = guess if (guess == ans): print("Bingo!!") break