import string
import numpy
while True:
ch_val_str=input('How many characters? ');
try:
ch_val = int(ch_val_str)
break
except ValueError:
continue
ch_array=numpy.zeros((ch_val, 2), dtype=float)
for i in range(ch_val):
count = i + 1
while True:
bwcolor_str=input("For character number "+str(count)+", enter b for b/w and c for color: ")
if bwcolor_str.strip().lower().startswith('c'):
ch_array[count-1][0]=2
break
elif bwcolor_str.strip().lower().startswith('b'):
ch_array[count-1][0]=1
break
else:
continue
for i in range(ch_val):
count = i + 1
while True:
xpr_str=input("For character number "+str(count)+ ", how many expressions would you like? ");
try:
xpr = int(xpr_str)
break
except ValueError:
continue
except xpr <=0:
continue
if xpr<9:
ch_array[i][1]=xpr*1.50;
else:
ch_array[i][1]=((xpr//9)*12)+((xpr%9)*1.5);
j=0
sum=0
for j in range(ch_val):
sum+=(ch_array[j][0])*(ch_array[j][1]);
j=j+1;
print("Your cost is $"+str(sum)+" USD.")