Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Python のループを作成して、異なる入力値の変数を作成しようとしています。 name 変数に 3 つの異なる単語を入力したいと考えています。これは私のコードです:
name = raw_input("What is your name? ") if len(name) > 0: print name
入力から入力を止めるまでアクションを繰り返したい。
たぶん(あなたが何を求めているのか理解できるかどうかはわかりませんが)
n = 0 while n < 3: name = raw_input('What is your name?') if name: print name n + =1
変数名は毎回変わりますので注意してください。