-1
input_data = int(input("What's your number? "))

if (input_data > 10):
    print (f"{input_data} Greater than Ten")
else:
    print(f"{input_data} less than Ten")

It prints:

What's your number? _____ ex:- 25
25 Greater than Ten

I would like the result to be printed above input after putting input.

First:

What's your number? _____ 

Then: After putting a number, it should print:

25 Greater than Ten
What's your number? _____ 

Is there a possibility to take input at the 10th or higher line in the console but print its value at the 1st line?

Blue Robin
  • 847
  • 2
  • 11
  • 31

1 Answers1

0

I have solution but its pretty hard to understand.

Firstly you need to install windows-curses using command pip install windows-curses.

You would need to watch some tutorial on it since I'm quite new to it too.

stdscr.addstr(y, x, 'text') # first comes y/row on which it will add string and x/column

import curses
from curses import wrapper


def main(stdscr):
    key = ''
    input_data = ''
    while True:
        stdscr.addstr(10, 0, f'What\'s your number? {input_data}')
        if key == '\n':
            input_data = input_data.split('\n')[0]
            break
        key = stdscr.getkey()
        input_data += key
    if (int(input_data) > 10):
        stdscr.addstr(0, 0, f"{input_data} Greater than Ten")
    else:
        stdscr.addstr(0, 0, f"{input_data} less than Ten")
    stdscr.refresh()
    stdscr.getch()


wrapper(main)
Gren Man
  • 110
  • 9