python - Storing Multiple User inputs while using a loop -


my intent here query user multiple inputs using loop stops when user inputs , integer of zero. need able recall data in later line of code. in mind i'm trying create list of users input.

python 3 code

i = false val1 = [] while == false:     if  val1 != 0:         val1 = eval(input("enter integer, value ends if 0: "))     else:         = true         print(val1) 

i think cleaner if use infinite loop , break if input 0. otherwise, append the list.

values = [] while true:     val = int(input("enter integer, value ends if 0: "))     if val == 0:         break     values.append(val) 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -