Question: Python Question 1: In the enchanted forest called Foregon lives Nogerof the Wizard. She asks everyone who comes into the woods three integer numbers and
Python
Question 1: In the enchanted forest called Foregon lives Nogerof the Wizard. She asks everyone who comes into the woods three integer numbers and she can immediate tell whether the sum of these numbers is an odd number or not. Write a Python function called nogerof to imitate this story (this may call other functions too). The Wizard asks questions like 'Now tell me your number 1', 'Now tell me your number 2', and so on. These questions must be generated dynamically. In other words, do not hard code these questions as a list of three fixed strings. Instead it is important to utilize the pattern of the questions and generate them on the fly using some kind of string formatting methods.
Part 2: Previously, the Wizard asks questions like "Now tell me your number 1." This is somehow awkward. Now she has got a better way to ask: "Now tell me your first number", "Now tell me your second number", and so on. Write a Python program to do this (i.e., asking the questions, getting the sum, and telling if the sum is an odd or even number). Again, don't hard code the questions.
This is the code I have written so far but I am unable to figure out how to make the questions dynamic.
def nogerof(): x = int(input('Enter your number 1: ')) y = int(input('Enter your number 2: ')) z = x + y if (z % 2) == 0: print("{} is Even".format(z)) else: print("{} is Odd".format(z))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
