# review and run GREET COUNT
greet_count = 5
# loop while count is greater than 0
while greet_count > 0:
print(greet_count, "!")
greet_count -= 1
print("\nIGNITION!")
5 !
4 !
3 !
2 !
1 !
IGNITION!
# [ ] Create the Animal Names program, run tests
num_animals = 4
all_animals = ''
while num_animals > 0:
animal_name = input('Please put in an animal (Put in exit to exit) : ')
if animal_name.lower().startswith('exit'):
num_animals = 0
else:
all_animals = all_animals +', '+ animal_name.title()
num_animals -= 1
if all_animals == '':
print ('No animals were entered')
else:
print ('Animals entered: ', all_animals)
Animals entered: , Horse, Cow, Chicken, Goat
# review and run example that loops until a valid first name format is entered
student_fname = ""
while student_fname.isalpha() == False:
student_fname = input("enter student\'s first (Letters only, No spaces): ")
print("\n" + student_fname.title(),"has been entered as first name")
Zarife has been entered as first name
# [ ] Create the program, run tests
int_num = input('Please put in a number')
long_num = ''
while int_num.isdigit():
long_num = long_num + int_num
int_num = input('Please put in a number')
print (long_num)
1213243432525
# [ ] review the code, run, fix the Logic error
count = 1
# loop 5 times
while count < 6:
print(count, "x", count, "=", count*count)
count +=1
1 x 1 = 1
2 x 2 = 4
3 x 3 = 9
4 x 4 = 16
5 x 5 = 25