logo

Crowdly

Browser

Додати до Chrome

Programming for Engineers || Spring25

Шукаєте відповіді та рішення тестів для Programming for Engineers || Spring25? Перегляньте нашу велику колекцію перевірених відповідей для Programming for Engineers || Spring25 в elearn.squ.edu.om.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Переглянути це питання
The index of the last item in a list is the length of the list.
50%
50%
Переглянути це питання

The following code segment is supposed to display all of the elements in a list with dashes between them. For example, if values contains [1, 2, 3, 4, 5] then the program should display 1-2-3-4-5.

 

result = ""

for i in range(len(values)) :

   if i > 0 :

      _____________________

   result = result + str(values[i])

 

print(result)

What line of code should be placed in the blank to achieve this goal?

0%
0%
0%
0%
Переглянути це питання

Consider the following code segment:

 

  data = {"A": 65, "B": 66, "C": 67}

  print(data["Z"])

 

What will be displayed when this code segment executes?

Переглянути це питання
What is printed by the following code snippet?
words = ["Today", "is", "Wednesday", "tomorrow", "is", "Thursday"]
i = 0
while i < (len(words)) :
   word = words[i]
   if len(word) < 8 :
      words.pop(i)
   else :
      i = i  + 1
print(words)    
Переглянути це питання

The following code segment is supposed to count the number of

times that the number 5 appears in the list

values

.

counter = 0
____________________
   if (element == 5) :
      counter = counter + 1

What line of code should be placed in the blank in order to achieve

this goal?

0%
0%
0%
0%
Переглянути це питання

What is missing from this code snippet to find the longest

value in the list?

colors = ["red", "purple", "blue", "green", "yellow", "light green"]
longest = colors[0]
for i in range(1, len(colors)) :
   _____________________
      longest = colors[i]
0%
0%
0%
0%
Переглянути це питання

Consider the following code segment:

def f1():

print("a", end="")

return "b"

def f2():

print("c", end="")

d = f1()

print(d, end="")

print("e", end="")

def f3():

print("f", end="")

f2()

print("g", end="")

f3()

  

What output is generated when it runs?

0%
0%
0%
0%
Переглянути це питання

Consider the following function:

 

def mystery(a=3, b=2) :

   result = (a - b) * (a + b)

   return result

What is the result of calling mystery()?

Переглянути це питання

The following function is supposed to compute and display the

value of n-factorial for integers greater than 0.

def factorial(n) :
   result = 1
   for i in range(1, n + 1) :
     result = result * i

What is wrong with this function?

0%
0%
0%
0%
Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на elearn.squ.edu.om?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome