# 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 name an animal then when you're finished type exit").lower()
if animal_name.startswith("exit"):
print("No more animals entered\n")
break
else:
print(animal_name,"added")
all_animals += ' ' + animal_name.title()
num_animals -= 1
if all_animals == '':
print("no animals entered")
else:
print("Animals entered:",all_animals)
tiger added
lion added
zebra added
dog added
Animals entered: Tiger Lion Zebra Dog
# 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")
# [ ] Create the program, run tests
int_num = input("Enter a number and type G when done: ")
long_num = ''
while int_num.isdigit():
long_num = long_num + int_num
int_num = input('Enter a number type G when done: ')
print(long_num)
1075
# [ ] 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