Avatar ·

Multiline input()

📁 function, Advanced Python Topics, question, example, AI

How can I make a multiline input()? After all, this function, when entering certain characters and then pressing Enter, if the program consists only of

a=input() print(a) 

will simply terminate. So the question is: is it possible to make input() terminate when a specific key is pressed, for example, Esc

Avatar ·

This problem is called

One of the implementations (taken from ):

def primfacs(n):   i = 2   primfac = []   while i * i <= n:       while n % i == 0:           primfac.append(i)           n = n / i       i = i + 1   if n > 1:       primfac.append(n)   retu primfac

Log in to leave an answer

Blogs