TypeError - Int object not iterable

时间:2017-07-08 15:43:39

标签: python python-3.x int

As part of an assignment, I've been trying to create a function which will create n new lines—but I can't figure out for the life of me how to fix this error.
Here's the code snippet:

def newLines(lines):
    for i in lines:
        print()

print("This is a string")
newLines(2)
print("This is also a string")

..which returns:

TypeError: 'int' object is not iterable

0 个答案:

没有答案