Skip to main content
Back

Outputs and Formatting in Python

Study Guide - Practice Questions

Test your knowledge with practice questions generated from your notes

  • #1 Multiple Choice
    Which of the following format specifiers would you use to display the number 12345678 as '12,345,678' in Python using the format method?
  • #2 Multiple Choice
    Suppose you want to print the following table using the format method in Python: Rank Player HR 1 Barry Bonds 762 2 Hank Aaron 755 3 Babe Ruth 714 Which format string would best align the columns as shown?
  • #3 Multiple Choice
    Given the code: print('The population of {0} is {1:.2%} of the U.S. population.'.format('Texas', 26438000/309000000)) What will be the output?

Study Guide - Flashcards

Boost memory and lock in key concepts with flashcards created from your notes.

  • Python format() Method and Number Formatting
    7 Questions
  • Justifying Output in a Field
    6 Questions
  • print() Function Arguments: sep and end
    5 Questions