All Programs

Basic Python Programs

Simple Python programs

If Condition Programs

If condition based Python Programs

Looping based programs

program based on for loop, while loop, range

Searching and Sorting

Python Searching Programs
Python Sorting Programs

Python program to check number is -ve or not

Solution with out using functions
Solution using functions without passing arguments
Solution using functions and by passing arguments

For better understanding of this example, one should have the knowledge of the following Python programming topics:

```n=int(input("Enter any number "))
if(n<0):
print("Number is -ve")
else:
print("Number is not -ve")```

Output:

case 1:
Enter any number 95
Number is not -ve
>>>
case 2:
Enter any number -45
Number is -ve
>>>

Solution : Using function Without Passing Arguments Program/Source Code

```#function definition
def check():
n=int(input("Enter any number "))
if(n<0):
print("Number is -ve")
else:
print("Number is not -ve")

#function calling
check()```

Output:

case 1:
Enter any number 25
Number is not -ve
>>>
case 2:
Enter any number -54
Number is -ve
>>>

Solution : Using function Passing Arguments Program/Source Code

```#function definition
def check(n):
if(n<0):
print("Number is -ve")
else:
print("Number is not -ve")

#function calling
n=int(input("Enter any number "))
check(n)```

Output:

case 1:
Enter any number 6
Number is not -ve
>>>
case 2:
Enter any number -9
Number is -ve
>>>

Interview Questions

C Programming
C++ Programming
Basic Python Tutorial