Question 6 of 40

DRAG DROP -

You are building a Python program that displays all of the prime numbers from 2 to 100.

How should you complete the code? To answer, drag the appropriate code segments to the correct location. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

NOTE: Each correct selection is worth one point.

Select and Place:

    Correct Answer:

    References:

    https://docs.python.org/3.1/tutorial/inputoutput.html

    https://stackoverflow.com/questions/11619942/print-series-of-prime-numbers-in-python https://www.programiz.com/python-programming/examples/prime-number-intervals

Question 7 of 40

DRAG DROP -

You are creating a Python script to evaluate input and check for upper and lower case.

Which four code segments should you use to develop the solution? To answer, move the appropriate code segment from the list of code segments to the answer area and arrange them in the correct order.

Select and Place:

    Correct Answer:

    References: https://www.w3resource.com/python/python-while-loop.php

Question 8 of 40

HOTSPOT -

You develop a Python application for your company.

You have the following code. Line numbers are included for reference only.

Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.

Hot Area:

    Correct Answer:

    References: http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html http://interactivepython.org/runestone/static/pythonds/BasicDS/InfixPrefixandPostfixExpressions.html

Question 9 of 40

The ABC company has hired you as an intern on the coding team that creates e-commerce applications.

You must write a script that asks the user for a value. The value must be used as a whole number in a calculation, even if the user enters a decimal value.

You need to write the code to meet the requirements.

Which code segment should you use?

    Correct Answer: D

    To meet the requirement where the user input must be treated as a whole number even if entered as a decimal, the appropriate approach is to convert the input to an integer. This can be done directly using the int() function on the input. The correct code segment here is totalItems = int(input('How many items would you like?')). This code will throw an error if a float value is entered, but the requirement specifies the use of the value as a whole number, which int() handles correctly for integer inputs.

Question 10 of 40

HOTSPOT -

You create the following program to locate a conference room and display the room name. Line numbers are included for reference only.

Colleagues report that the program sometimes produces incorrect results.

You need to troubleshoot the program. Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.

Hot Area:

    Correct Answer:

    References:

    https://www.w3resource.com/python/python-data-type.php

    https://www.w3resource.com/python/python-if-else-statements.php