ansible sudo example in docs fails

I’m new to Ansible and working through the Getting Started in the docs. It shows to use sudo mode just add --sudo flag, but that fails:

ansible tv -m ping (works)

ansible tv -m ping --sudo (fails with sudo: a password is required)

Shouldn’t Ansible prompt me for a password for sudo mode?

I'm new to Ansible and working through the Getting Started in the docs. It
shows to use sudo mode just add --sudo flag, but that fails:

Do you mean this one
https://docs.ansible.com/ansible/2.7/user_guide/intro_getting_started.html

If so, I do recommend reading everything on that page first, because the information you are asking is there just a little scattered around on the page.

ansible tv -m ping (works)
ansible tv -m ping --sudo (fails with sudo: a password is required)

Shouldn't Ansible prompt me for a password for sudo mode?

From the bottom of this section

https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html#remote-connection-information

  "If using sudo features and when sudo requires a password, also supply --ask-become-pass (previously --ask-sudo-pass which has been deprecated)."

--sudo is also deprecated you find that information in the example in this section
https://docs.ansible.com/ansible/2.7/user_guide/intro_getting_started.html#your-first-commands

  # With latest version of ansible `sudo` is deprecated so use become
  # as bruce, sudoing to root"
  $ ansible all -m ping -u bruce -b

The -b is short version of --become that has replaced -s/--sudo, and the example should have used --become instead of -b to make it more clear.

Good luck in your quest to learn Ansible it's a great tool.