# 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!")
# [ ] Create the Animal Names program, run tests
animal_name=""
animal_num=0
all_animals=""
while animal_num <=4:
animal_name=input("Name an animal:")
if animal_name=="exit":
print("Exiting...")
if animal_names=="":
print("no animals")
break
else:
print("The animals you have named are:",all_animals)
break
elif animal_name.isalpha():
animal_num+=1
all_animals=all_animals+" "+animal_name
else:
print("error")
if animal_num>0:
print("The animals you have names are:",all_animals)
Exiting...
The animals you have named are: fish dog
The animals you have names are: fish 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 an integer: ")
long_num=""
while int_num.isdigit()==True:
long_num=long_num+int_num
int_num=input("Enter an integer: \nType exit to escape.")
if int_num.isdigit()==False:
if int_num=="exit":
break
else:
print("please enter an integer")
print (long_num)
2266
5
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