Respuesta :

Answer:

The code is given below

var array = [3, 6, 2, 56, 32, 5, 89, 32];

var largest = 0;

// Write your code below!

for (var i = 0; i < array.length; i++){

 if (array[i] > largest) {

   largest = array[i];

}

}

console.log(largest);

Answer:

# empty dictionary to hold the category

dictionary = {}

# user is prompt to enter category 1

category1 = input("Enter category1: ")

# user is prompt to enter category 2

category2 = input("Enter category2: ")

# user is prompt to enter category 3

category3 = input("Enter category3: ")

# empty list for category 1

category1_item = []

# loop to accept 3 items for category1

for i in range(3):

item = input("Enter item in the category1: ")

category1_item.append(item)

# category1 item is assigned to category1

dictionary[category1] = category1_item

# empty list for category2

category2_item = []

# loop to accept 3 items for category2

for i in range(3):

item = input("Enter item in the category2: ")

category2_item.append(item)

# category2 item is assigned to category2

dictionary[category2] = category2_item

# empty list for category 3

category3_item = []

# loop to accept 3 items for category3

for i in range(3):

item = input("Enter item in the category3: ")

category3_item.append(item)

# category3 item is assigned to category 3

dictionary[category3] = category3_item

# loop throughout the dictionary to

# print each category and its item.

for key, value in dictionary.items():

print(key, ":", value)

Explanation:

Complete Question is:

5.4.7: Categories. Write a program that asks the user for three categories. For each category, ask the user for three things in that category. You should print something for each category that states the category and the three things in that category.

The program is written in Python and well commented.