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)
here fun(8) will also come mark that..Also last fun is fun(-3-2) because question is for -3-2 in book
ReplyDeleteOh!! , I have correct it .... : )
Deletewhy did you return square of the numbers.
ReplyDeletethey asked the number that follows after it which means the number which comes after the given number right.
You understand question wrongly in this question only you have to make any function and pass that numbers.
DeleteBro,the func is wrong.
ReplyDeleteIt 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)
No....
DeleteDidnt Understand, According to the question it says to return number that follows after it,
ReplyDeleteBut your Program is returning the Squares of the Numbers....
You understand question wrongly in this question only you have to make any function and pass that numbers.
Deletedef fun(x):
ReplyDeleteprint(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
ok, Thankyou for telling us.
Deletehii bros
ReplyDeletethank you bro
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )