nerdexam
GIAC

GPYC · Question #3

Which of the following commands would correct the error in the screenshot? >>> tcp_flags_as_str(flag): ... def tcp_flags_as_str(flag): ... tcp_flags = ['CWR', 'ECE', 'URG', 'ACK', 'PSH', 'RST', 'SYN',

Sign in or unlock GPYC to reveal the answer and full explanation for question #3. The question stem and answer options stay visible for context.

Python Fundamentals & Command Line Tools

Question

Which of the following commands would correct the error in the screenshot?
tcp_flags_as_str(flag): ... def tcp_flags_as_str(flag): ... tcp_flags = ['CWR', 'ECE', 'URG', 'ACK', 'PSH', 'RST', 'SYN', 'FIN'] ... return "|".join(list(itertools.compress(tcp_flags,map(int,format(flag ... tcp_flags_as_str(2) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in tcp_flags_as_str NameError: name 'itertools' is not defined

Options

  • Aimport itertools
  • Bmodular itertools
  • Creturn itertools
  • Ddefine itertools

Unlock GPYC to see the answer

You've previewed enough free GPYC questions. Unlock GPYC for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#import statements#modules#NameError#itertools
Full GPYC Practice