Computer Science, asked by nsreddy581, 10 months ago

def thing():
print('Hello')

print('There')
what it prints

Answers

Answered by poojan
1

Actually, there are two possibilities of making assumptions on this code. Here, we provide you the two.

Code 1 :

def thing():

print('Hello')

print('There')

Output :

INDENT ERROR at print('Hello')

Explanation :

In Python, the interpreter interprets the lines in the code one by one. When it triggers the function def thing(): , it expects the next statement to be in the function as the function can't be empty.

So, it thinks that print('Hello')  should be in the def thing():  which was faultly written outside the function not following the indentation. So, it raises an indentation error.

Code 2:

def thing():

   print('Hello')

print('There')

Output :

There

Explanation :

In python, to execute a function, it should must get called from outside that function. As no functin call was made, it just print the data in the print statement outside the function - "There"

Learn more :

1. Indentation is must in python. Know more about it at :

brainly.in/question/17731168

2. Python program to find absolute difference between the odd and even numbers in the inputted number.

brainly.in/question/11611140

Similar questions