UPSC Exam  >  UPSC Questions  >  What will be the output of following code fra... Start Learning for Free
What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:
print (Not Five")?
Most Upvoted Answer
What will be the output of following code fragment if the input given ...
Explanation:

Input (i): 7
- The code fragment will prompt the user to enter a number.
- In this case, the user enters 7.
- The code then checks if the input number is equal to -5, which is not the case.
- Therefore, the condition in the if statement evaluates to False.
- The else block will be executed, and "Not Five" will be printed as output.

Input (ii): 5
- The code fragment will prompt the user to enter a number.
- In this case, the user enters 5.
- The code then checks if the input number is equal to -5, which is not the case.
- Therefore, the condition in the if statement evaluates to False.
- The else block will be executed, and "Not Five" will be printed as output.
In both cases, the output will be "Not Five" because the input number is not equal to -5.
Explore Courses for UPSC exam
What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")?
Question Description
What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? for UPSC 2024 is part of UPSC preparation. The Question and answers have been prepared according to the UPSC exam syllabus. Information about What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? covers all topics & solutions for UPSC 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")?.
Solutions for What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? in English & in Hindi are available as part of our courses for UPSC. Download more important topics, notes, lectures and mock test series for UPSC Exam by signing up for free.
Here you can find the meaning of What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? defined & explained in the simplest way possible. Besides giving the explanation of What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")?, a detailed solution for What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? has been provided alongside types of What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? theory, EduRev gives you an ample number of questions to practice What will be the output of following code fragment if the input given is (i) 7 (ii) 5? a = input('Enter a number') if (a = - 5) : print ("Five") else:print (Not Five")? tests, examples and also practice UPSC tests.
Explore Courses for UPSC exam
Signup to solve all Doubts
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev