EOFError: EOF when reading a line

后端 未结 3 1378
误落风尘
误落风尘 2020-11-30 05:03

I am trying to define a function to make the perimeter of a rectangle. Here is the code:

width = input()
height = input()
def rectanglePerimeter(width, heigh         


        
3条回答
  •  感动是毒
    2020-11-30 05:16

    **The best is to use try except block to get rid of EOF **

    try:
        width = input()
        height = input()
        def rectanglePerimeter(width, height):
           return ((width + height)*2)
        print(rectanglePerimeter(width, height))
    except EOFError as e:
        print(end="")
    

提交回复
热议问题