Q. Write a program with a function that takes an integer and prints the number that follows after it: Call the function with these arguments:

4, 6, 8, 2+1, 4 - 3 * 2, -3 - 2


Answer =


def fun(x):
    print (x +1)

fun(4)
fun(8)
fun(6)
fun(2+1)
fun(4-3*2)
fun(-3-2)


12 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. here fun(8) will also come mark that..Also last fun is fun(-3-2) because question is for -3-2 in book

    ReplyDelete
  2. why did you return square of the numbers.
    they asked the number that follows after it which means the number which comes after the given number right.

    ReplyDelete
    Replies
    1. You understand question wrongly in this question only you have to make any function and pass that numbers.

      Delete
  3. Priyabrat Omm Kumar19 May 2021 at 16:45

    Bro,the func is wrong.
    It says to print the number that follows,e.g.-if 4 is given ,it must print 5.
    The func should be:

    def fun(x):
    print(x+1)

    ReplyDelete
  4. Didnt Understand, According to the question it says to return number that follows after it,
    But your Program is returning the Squares of the Numbers....

    ReplyDelete
    Replies
    1. You understand question wrongly in this question only you have to make any function and pass that numbers.

      Delete
  5. def fun(x):
    print(x+1)
    this should be in the program
    not
    def fun(x):
    print(x**2)
    number after -----> next number ie number +1
    pls rectify as soon as possible

    ReplyDelete
  6. thank you bro

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post