Imposible


#1

I cant understand what is the problem:

def option_1(products_list)
	print products_list

the full code:

def option_1(products_list)
	print products_list
	
def option_2(products_list)
	print len(products_list)
	
def option_3(i, products_list)
	x = raw_input("Enter product: ")
	i = products_list.find(x)
	print i
	
def option_4(i)
	
	return i
	
def option_5(i, products_list)
	products_list.remove(i)
	return i
	
def option_6(products_list, i)
	products_list.append(i)
	return product_list
	
def option_7(products_list)
	products_list.sort()
	print products_list
	
def option_8(i, products_list)
	count = 0
	for num in range(i)
		if (products_list[count] <= 3 or )
			
			
	return i
	
def option_9()
	print "bay!"
	
def main()
	products_list = []
	num_of_products = raw_input("How much products you need?")
	for num in range(num_of_products)
		product = raw_input("Enter products: ")
		products_list.append(product)

	print "Options:"
	print "1) View the product list"
	print "2) How many products are listed"
	print "3) Is the product listed"
	print "4) How often does a particular product appear"
	print "5) Deleting a product from the list"
	print "6) Add a product to the list"
	print "7) Arranging the list according to AB"
	print "8) Print all illegal products"
	print "9) Exit"
	choice = raw_input("Enter value 1-9: ")
	if (choice < 1 or choice > 9):
		print "invalid value"
		choice = raw_input("Enter value:")
	i = len(products_list)

	if (choice == 1):
		option_1(products_list)
	elif (choice == 2):
		option_2(products_list)
	elif (choice == 3):
		option_3(i, products_list)
	elif (choice == 4):
		option_4(i)
	elif (choice == 5):
		i = raw_input("product to delete: ")
		option_5(i)
		print products_list
	elif (choice == 6):
		i = raw_input("Enter product:")
		option_6(i, products_list)
	elif (choice == 7):
		option_7(products_list)
	elif (choice == 8):
		option_8(i)
	elif (choice == 9):
		option_9(i)
		
	p_to_delete = raw_input("Which product whuld you like to delete:")
	how_much = products_list.count(p_to_delete)
	for p in range(how_much)
		products_list.remove(p_to_delete)
		
		
	
main()

#2

general function syntax:

def function_name():

in your case, the colon is missing. Not just once, but for many functions


#3

Tnx a lot!

בתאריך 17 באפר׳ 2017 16:33,‏ "Stetim94" codecademy@discoursemail.com כתב:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.