crash course on python week 1 quiz answers

crash course on python week 1 quiz answers

Week 1 Graded Assessment

16. Once you have learned the basics of a programming language, how does this affect your ability to learn and use a second programming language?"

  • You should only code in one language.
  • It’s easier to learn and use a second language.
  • It’s difficult to learn and use a second language.
  • The syntax and semantics will be the same.

17. What is a shorter piece code, typically used to automate a specific task?

  • Variable
  • Syntax
  • Script
  • Markup

18. What are some tasks that might be a good fit for full automation? Select all that apply.

  • Updating specific files on multiple computers
  • Detecting and removing duplicate data
  • Interviewing and hiring employees
  • Haircuts and styling

19. What is the term for the set of rules for how statements are constructed in a programming language?

  • Format
  • Semantics
  • Syntax
  • Grammar

20. What is the program that reads and executes Python code by translating it to computer instructions called?

  • Linker
  • Interpreter
  • Translator
  • Compiler

21. Write a Python script that outputs "Automating with Python is fun!" to the screen. Remember that syntax precision is important in programming languages. A missing capital letter, spelling error, or punctuation mark can produce errors.

# Enter code here:
_____
# Should print: Automating with Python is fun!

  • print(“Automating with Python is fun!”)

22. What should be the output of the expression below?

print((6-2)/(5*(1+4))+3)

  • 3.16
  • 50.0
  • 12.0
  • 5.0

23. In one year, if there are 365 days, with 24 hours in a day, and 60 minutes in an hour, write a program to calculate the number of minutes in a year. Print the result on the screen. Note: Your result should be in the format of just a number, not a sentence.

# Enter code here:
_____
# Should print 525600

  • minutes_in_hour = 60
    hours_in_day = 24
    days_in_year = 365

    minutes_in_year = minutes_in_hour * hours_in_day * days_in_year

    print(minutes_in_year)

24. Use Python to calculate how many number-based passcodes can be formed with 10 numerals (0 through 9). For a 1 numeral passcode, there would be 10 possibilities. For a 2 numeral passcode, each numeral is independent of the other, so there would be 10 times 10 possibilities. Using this information, print the amount of possible passwords that can be formed with 8 numerals. Note: Your result should be in the format of just a number, not a sentence.

# Enter code here:
____
# Should print 100000000

  • numerals = 10
    password_length = 8

    possible_passwords = numerals ** password_length
    print(possible_passwords)

25. Consider this scenario about using Python to make calculations:

In a managed computing environment, there are 200 remote computers that must download 200 MB (megabytes) of updates each month. There are 1024 KB (kilobytes) in each MB.

Fill in the blank in the code below to compute the number of total kilobytes downloaded by these computers from the remote update server each month.

download_size_kb = 200*1024
total_computers = 200
total_kbs = ____


print(total_kbs) # Should print 40960000.0

  • download_size_kb * total_computers

Shuffle Q/A 1

26. What is a function?

  • The beginning of a program defining who wrote it and why
  • A reusable block of code that performs a specific task
  • A document describing a software project
  • The task a program is written to accomplish

27. What are some of the benefits of automation? Select all that apply.

  • Consistency
  • Can accomplish creative tasks
  • More cost-effective for complex, seldom-done tasks
  • Doesn’t get tired

Devendra Kumar

Project Management Apprentice at Google

Leave a Reply