Question

Question 9 (CO 6) The best way to call the main() function of a program is...

Question 9

(CO 6) The best way to call the main() function of a program is to code

main()

a while statement that calls the main() function in each loop

an if statement that calls the main() function in each method

an if statement that calls the main() function only if the current module is the main module

Question 10

(CO 6) A variable that can only be used within the function that defines it is known as a ______

local variable

global variable

shadow variable

unknown variable

Question 11

(CO 6) Which of the following statements imports a module?

export temperature

import temperature

from temperature import

global temperature import

Question 12

(CO 5) To insert the item “chewie” after “solo” in the following list, which of the following methods would you use?

falcon = [“han”, “leia”, “solo”, “yoda”, “luke”]

falcon.pop(3,”chewie”)

falcon.remove(3,”chewie”)

falcon.insert(3,”chewie”)

falcon.insert(“chewie”, 3)

Question 13

(CO 5) The ______________ method adds an item to the end of a list.

index()

insert()

pop()

append()

Question 14

(CO 5) Given the following list, what is the value of names[5]?
names = [“Harry”, “Ron”, “Ginny”, “Draco”, “Rowena” ]

“Harry”

“Rowena”

“Ron”

None – index error

Question 15

(CO 5) What is the value of the total variable after the following code executes?

prices=[66, 22, 47, 30]
total = 0
i=1
while i<len(prices):
    total+=prices[i]
    i+=1
print(total)

35

66

0

99

0 0
Add a comment Improve this question Transcribed image text
Answer #1

9.The best way to call the main() function of a program is to code

main()

Answer:

an if statement that calls the main() function

10.variable that can only be used within the function that defines it is known as a

Answer:

local variable

11.Which of the following statements imports a module?

Answer:

Import temperature

Syntax:import module-name

12.To insert the item “chewie” after “solo” in the following list, which of the following methods would you use?

Answer:

falcon.insert(3,"chwie")

Syntax: listname.insert(index, object)

13.The ______________ method adds an item to the end of a list.

Answer:

append()

14.Given the following list, what is the value of names[5]?
names = [“Harry”, “Ron”, “Ginny”, “Draco”, “Rowena” ]

Answer:

None-index error

15.What is the value of the total variable after the following code executes?

prices=[66, 22, 47, 30]
total = 0
i=1
while i<len(prices):
    total+=prices[i]
    i+=1
print(total)

Answer:99

Thank you...

Add a comment
Know the answer?
Add Answer to:
Question 9 (CO 6) The best way to call the main() function of a program is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT