How to write a code In Python where input will be 1 then the output will be 2?

0 votes

Hello everyone if the user gives an input 1 then the output will be 2 how to write this as a code In Python??

Oct 6 in Python by Roshni
• 6,190 points
35 views

1 answer to this question.

0 votes

You can go through this: 

def num(number):
    return number + 1

print(num(1))
answered Oct 6 by Gitika
• 50,820 points

Related Questions In Python

0 votes
2 answers
0 votes
1 answer

How to correctly return an a dictionary as an output in zappier code using python?

David here, from the Zapier Platform team. ...READ MORE

answered Dec 3, 2018 in Python by charlie_brown
• 7,780 points
382 views
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by aryya
• 7,400 points
304 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,564 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,186 views
0 votes
1 answer

What will be the output of below code and why? x=[1,2,3,4,5] print(x.insert(2,3))

If you write x.insert(2,3) and then print x ...READ MORE

answered Oct 14 in Python by Gitika
• 50,820 points
160 views
0 votes
1 answer