Python, HTML, CSS, Javascript, Terraform Flashcards
What is PEP 8, and why is it important?
PEP 8 is a set of coding guidelines for writing Python code to make it readable and consistent.
How do you comment in Python?
Comments in Python are indicated by the # symbol. They are used to explain the code and make it more understandable.
Explain the difference between list and tuple in Python.
Lists are mutable sequences, while tuples are immutable sequences in Python.
What is the purpose of the __init__ method in Python classes?
The __init__ method is a special method used to initialize newly created objects in a class.
How do you handle exceptions in Python?
Exceptions in Python are handled using try-except blocks to prevent crashes when something goes wrong.
What is a virtual environment in Python, and why would you use one?
A virtual environment in Python is a self-contained directory that contains a Python installation and libraries specific to a project, isolating them from system-wide installations.
Explain the difference between == and is in Python.
”==” checks for equality of values, while is checks for object identity in Python.
How do you open and read a file in Python?
You can open and read a file in Python using the open() function with the appropriate mode (e.g., ‘r’ for reading) and then using methods like read() to read the file contents.
What is HTML, and what does it stand for?
HTML stands for Hypertext Markup Language, and it is used for creating the structure and content of web pages.
What are HTML tags and attributes?
HTML tags are elements used to structure content, and attributes provide additional information about elements.
Explain the difference between block-level and inline elements in HTML.
Block-level elements start on a new line and take up the full width available, while inline elements do not start on a new line and only take up as much width as necessary.
What is the purpose of the and tags in HTML?
The tag contains metadata about the document, while the tag contains the content of the document.
How do you create a hyperlink in HTML?
Hyperlinks in HTML are created using the <a> tag with the href attribute.</a>
What is the difference between <div> and <span> elements?</span></div>
<div> is a block-level container element, while <span> is an inline container element.</span></div>
How do you add comments in HTML?
Comments in HTML are written using .
Explain the difference between HTML and HTML5.
HTML5 is the latest version of HTML, introducing new semantic elements and features.
What are semantic elements in HTML5, and why are they important?
Semantic elements in HTML5 provide meaning to the content, making it more understandable for both browsers and developers.
How do you embed an image in HTML?
Images in HTML are embedded using the <img></img> tag with the src attribute specifying the image file URL.
What is CSS, and what does it stand for?
CSS stands for Cascading Style Sheets, and it is used for styling the appearance of HTML elements on web pages.