在 python3 中创建新的空列表时出现语法错误

Syntax error while creating a new empty list in python3

所以我是一个完全的新手,这是我在 python3 中编写的脚本,用于查找小于给定整数且可被 3 和 5 整除的所有数字:

def check_divisible():  
 num=(int(input("Give me a number: "))
 result = [ ]
 for i in range(num):
    if i<= num and num%3==0 and num%5==0:
        result.append(i)
        i+=1
 print("Numbers which are smaller than the given and divisile by both 3 and 5 are: ",result)

每当我执行代码时,第 3 行都会出现语法错误。我该如何解决这个问题?任何帮助将不胜感激。

def check_divisible():
    num = int(input("Give me a number: "))
    result = []
    for i in range(1, num):
        if i%3==0 and i%5==0:
            result.append(i)
  print(result)
def check_divisible():  
 num= int(input("Give me a number: "))
 result = []
 for i in range(num):
    if i<= num and num%3==0 and num%5==0:
        result.append(i)
        i+=1
 print("Numbers which are smaller than the given and divisile by both 3 and 5 are: ",result)

只是一些括号问题。修复了代码。