- Google Colab Tutorial
- Google Colab - Home
- Google Colab - Introduction
- What is Google Colab?
- Your First Colab Notebook
- Documenting Your Code
- Google Colab - Saving Your Work
- Google Colab - Sharing Notebook
- Invoking System Commands
- Executing External Python Files
- Google Colab - Graphical Outputs
- Google Colab - Code Editing Help
- Google Colab - Magics
- Google Colab - Adding Forms
- Google Colab - Installing ML Libraries
- Google Colab - Using Free GPU
- Google Colab - Conclusion
- Google Colab Useful Resources
- Google Colab - Quick Guide
- Google Colab - Useful Resources
- Google Colab - Discussion
Google Colab - Code Editing Help
The present day developers rely heavily on context-sensitive help to the language and library syntaxes. That is why the IDEs are widely used. The Colab notebook editor provides this facility.
In this chapter, let us see how to ask for context-sensitive help while writing Python code in Colab. Follow the steps that have been given wherever needed.
Step 1 − Open a new notebook and type in the following code in the Code cell −
Step 2 − Run the code by clicking on the Run icon in the left panel of the Code cell. Add another Code cell and type in the following code −
Tensor = torch.
At this point, suppose you have forgotten what are the various functions available in torch module. You can ask for the context-sensitive help on function names by hitting the TAB key. Note the presence of the DOT after the torch keyword. Without this DOT, you will not see the context help. Your screen would look like as shown in the screenshot here −
Now, select the desired function from the list and proceed with your coding.
Colab gives you the documentation on any function or class as a context-sensitive help.
Type the following code in your code window −
Tensor = torch.cos(
Now, hit TAB and you will see the documentation on cos in the popup window as shown in the screenshot here. Note that you need to type in open parenthesis before hitting TAB.
In the next chapter, we will see Magics in Colab that lets us to do more powerful things than what we did with system aliases.
Kickstart Your Career
Get certified by completing the courseGet Started