1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alexandr402 [8]
3 years ago
11

What is the output of the following code:

Computers and Technology
1 answer:
Oksi-84 [34.3K]3 years ago
3 0
<h2>Answer:</h2>

786

<h2>Explanation:</h2>

In Python, and of course many other programming languages, lists are one of the built-in data types used to store several items in a variable.

In creating a list, the items, which may be of different types (e.g integer, float, string e.t.c), are placed in a square bracket and each item is separated from the other by a comma. The following are an example of a list.

<em>myList = ["fish", "meat", 5, 8, "egg"]</em>

<em>scores = [10, 34, 78, 90]</em>

To access or retrieve an item in a list, the index of that item is used. Indexes start from 0. For example, in <em>myList </em>the first item (which is <em>fish</em>) has an index of  0. The second item (which is <em>meat</em>) has an index of 1 and so on. In <em>scores, </em>the first item (which is <em>10</em>) has an index of 0, <em>34 </em>has an index of 1, <em>78 </em>has an index of 2 and so on.

Now;

i. to access the first item in <em>myList, </em>we simply write: myList[0]. This will give <em>fish</em>

ii. to access the third element in <em>scores, </em>we simply write: scores[2]. This will give <em>78</em>

From the list given in the question which is:

list1 =  [ 'cyber', 786 , 2.23, 'square', 70.2 ]

print(list1[1]) will print the item at index 1 which is 786.

Therefore, the output of the code is <em>786</em>

<em></em>

<em></em>

<em></em>

You might be interested in
Which line of code will use the overloaded division operation?
DerKrebs [107]

Answer:

B. result = numA/numB

Explanation:

__truediv__ overloads the / operator in Python. Since that has been defined in the class "num" and numA and numB are both objects of type "num" (numA / numB) will call num.__truediv__ using numA as "self" and numB as "b".

7 0
3 years ago
PLEASE HELP ME!!!!!! ITS FOR 100 POINTS AND BRAINLIEST!!!!!!!! NO ONE EVER WANTS TO ANSWER MY QUESTION!!! I JUST NEED SOMEONE TO
Veronika [31]

Answer: my suggestion is to ask a teacher and do research like look up the best shoe companies and things like that

Explanation:

6 0
3 years ago
Write a program to calculate student's average test scores and the grade. You may assume the following input data:
Brums [2.3K]

Answer:

def gradeAverage():

   grades = []

   i = 0

   while i < 5:

       a = int(input('enter score ' + str(i + 1) + ': '))

       grades.append(a)

       i = i+1

   #print(grades)

   average = sum(grades)/len(grades)

   #print(average)

   return average

def lettergrade(a):

   letter = 'A'

   if a < 60:

       letter = 'F'

   elif 59 < a < 63:

       letter = 'D-'

   elif 62 < a < 67:

       letter = 'D'

   elif 66 < a < 70:

       letter = 'D+'

   elif 69 < a < 73:

       letter = 'C-'

   elif 72 < a < 77:

       letter = 'C'

   elif 76 < a < 80:

       letter = 'C+'

   elif 79 < a < 83:

       letter = 'B-'

   elif 82 < a < 87:

       letter = 'B'

   elif 86 < a < 90:

       letter = 'B+'

   elif 89 < a < 94:

       letter = 'A-'

   elif 93 < a < 101:

       letter = 'A'

   return letter

numOfStudents = int(input('How many students: '))

names = []

aver = []

grade =[]

while numOfStudents > 0:

   studentName = input('Enter students name: ')

   names.append(studentName)

   a = gradeAverage()

   aver.append(a)

   grade.append(lettergrade(a))

   numOfStudents = numOfStudents - 1

for name in names:

       for score in aver:

           for letter in grade:

               if names.index(name) == aver.index(score) == grade.index(letter):

                   print('%s : Average =  %d  Letter Grade:  %s \n' %(name, score, letter))

                   break

Explanation:

The programming language used is python.

Two functions were created, the first function gradeAverage() was used to calculate the average values of the scores.

The second function lettergrade(a) was used to get the letter grade i.e(A, A-, C, D, e.t.c.) and it takes its argument from the average.

The main block of code asks for how many students are there and prompts the user to input their names and scores for all the students.

It takes that data calculates the average and the letter grade and prints out the names of the students, their average and their letter grade.

7 0
3 years ago
Explain why the scenario below fails to meet the definition an assembly line.
vichka [17]

Answer:

its not an assembly line

Explanation:

assembly lines have ppl who aren't experts and are taught to only do one simple part of a much much bigger thing

4 0
3 years ago
Which of the following is a great collection of resources for those entering the workplace or embarking on a new career?
Sloan [31]
Please type in the following.
Thanks
6 0
3 years ago
Read 2 more answers
Other questions:
  • You can undo up to the most recent 40 actions by clicking the undo button.
    9·1 answer
  • Silver, lead, and hydrogen are examples of what type of matter?
    12·1 answer
  • What is the Difference between CUI and GUI
    14·2 answers
  • What is the top folder of the file tree called
    5·2 answers
  • In order to recover from an attack on any one server, it would take an estimated 14 hours to rebuild servers 1, 2, 3, and 4 and
    6·1 answer
  • Grandma Ester normally gives you hugs for your birthday - one for every year old you are. When you turned 15, she squished you w
    8·1 answer
  • True or False
    11·1 answer
  • A computer takes a lot of time to do complex calculation​
    9·1 answer
  • Consider the following code segment.
    10·1 answer
  • Select all the correct answers<br> Which TWO statements describe the functions of wireless media?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!