+ 5
In Python, for is used to move through a collection of values. For example: for letter in 'abcde': print(letter) Each letter will be printed one after another, then the code moves on. With while you give a condition; as soon as it's not true anymore, the loop stops. x = '' while x != 'yes': print('Will you help me?') x = input() The user will be asked over and over until they type 'yes'.
1st Feb 2019, 11:09 AM
HonFu
HonFu - avatar