Check your understanding of the previous reading: importing standard-library and third-party functions, and the Drafter web-app library.
Which of the following statements are true about importing? Select every one that is true.
Select every option that is true, then check.
calculate_area example calls the imported floor function right inside a function you define. Imported functions work like any other function.calculate_area example reads the imported pi variable from inside a function you define.Re-read "Why External Functions" and "Third Party Libraries": only one of these five statements matches what the reading actually says.
Which of the following Drafter functions or components shown in the reading can be used to create or style page content? Select every one that is.
Select every option that comes from Drafter and shapes what a page shows, then check.
bold styles its text argument, as in the reading's "Bolder Text" section.italic is one of the styling functions introduced in "Composing Functions".change_color changes the color of its text argument, also from "Composing Functions".Page creates the web page with the specified content; every route in the reading returns one.Div is a component that arranges its children in a line, used in "Multiple Lines of Content".randint comes from the standard library's random module, from earlier in this same reading; it has nothing to do with Drafter or page content.floor comes from the math module, used earlier in this reading to compute an area; it does not create or style page content.Two of the seven options are from other modules covered earlier in this same reading, not from Drafter at all.
Which of the following function calls use Drafter functions in ways demonstrated in the reading? Select every one that is.
Select every call that matches how the reading actually uses that function, then check.
bold takes a single piece of text to style, exactly as in "Bolder Text".italic also takes a single piece of text, as used in "Multiple Lines of Content".change_color takes the text first and the color second, matching "Composing Functions".bold is only ever called with a single argument; a color is not part of how it's demonstrated.change_color with both the text and the color; a single argument doesn't match that.Check each call's arguments against how the reading calls the same function: how many arguments, and in what order?
True or False: will the following code create a Drafter site whose custom page displays the text "Welcome!" in bold?
from drafter import *
@route
def index() -> Page:
return Page(bold("Welcome!"))
start_server()
Select one answer, then check.
@route that returns a Page wrapping bold("Welcome!").@route function returning Page(bold(...)), with start_server() called at the end.Compare it line by line to the reading's "Bolder Text" example.
Why will the following route display "Welcome!" as regular text instead of bold text?
from drafter import *
@route
def index() -> Page:
bold("Welcome!")
return Page("Welcome!")
start_server()
Select one answer, then check.
bold(...) straight to Page, with no Div involved.bold("Welcome!") on its own line does nothing with its result; the return statement builds its own, separate, unstyled string to hand to Page.Page("Welcome to my Drafter site!") with a plain string, so this works fine.@route above the def line, exactly as it is here.start_server() last, after the route is defined, just like here.Compare this route to "Bolder Text": there, bold(...) is passed straight into Page(...) on the return line. Here it isn't.
According to the simplest Drafter example in the reading, which of the following are required for that minimum program? Select every one that is required.
Select every option the simplest example actually contains, then check.
start_server().Page only shows up once a route is defined; the simplest example has neither.Div only appears once content has multiple parts to arrange, much later than the simplest example.Look back at "Drafter Example" itself: it's only two lines long.