これはループです:Pythonで 'for loop'を 'while loop'として書き直すにはどうしたらいいですか?
for c in "Hi there":
print(c.upper())
これは、whileループのように書き換えの私の試みです:
phrase = "Hi there"
while len.phrase > 0
print (c.upper())
これはループです:Pythonで 'for loop'を 'while loop'として書き直すにはどうしたらいいですか?
for c in "Hi there":
print(c.upper())
これは、whileループのように書き換えの私の試みです:
phrase = "Hi there"
while len.phrase > 0
print (c.upper())
は、私が見るカップルの事があります
phrase = "Hi there"
limit = len(phrase);
itery =0;
while itery<limit:
print (phrase[itery].upper());
itery+=1;
イテレータを使用しますここで間違っている。
まず、whileステートメントの最後にコロンを使用することを忘れてしまいます。
while 1:
1としては、常に(パイソンの場合)が真となり、それは次のように無限ループを実行します。
while len.phrase > 0:
第二に、このタスクを実行するより効率的な方法は以下の通りでありますあなたの前の試みはやりたいと思っています。