Recreating the integer guessing game
Hello, fellow KNIMErs!
The following Python code (or something like it) is often found in learning textbooks. I’m building use cases to explain snippets (recipes?) for a group of my son’s friends who’ve been immersed in Python and want to better understand workflow development and understand equivalencies: how would I write this in KNIME?
I’ll be the first to admit that I have very little experience with the Widget nodes and building interfaces for input. Can someone help me with an example workflow that recreates this Python code?
def guessing_game():
answer = random.randint(0, 100)
while True:
user_guess = int(input('What is your guess (random between 0-100): '))
if user_guess == answer:
print(f'Right! The answer is {user_guess}')
break
if user_guess < answer:
print(f'Your guess of {user_guess} is too low!')
else:
print(f'Your guess of {user_guess} is too high!')