Variables, Operators, and Data Types

External Resources

Common Questions

Q1: How do you delete cells in the notebook?

A: There are two ways to delete cells in a notebook-

  • Select the cell you want to delete, press ESC and press D twice.

  • Select the cell you want to delete, go to Edit on Menu bar and click on Delete cells.

Q2: How can I display an image within a markdown cell in a notebook?

A: You have to upload the image to https://imgur.com/ then hover over the image, right click on mouse, choose copy link address and paste that link in the syntax.

For example - ![Some-image-title](https://imgur.com/GEn2Z37.png)

Q3: I added an image from my computer in my notebook and it's not showing on Jovian. What to do?

A: You have to upload the image to https://imgur.com/ then copy the link address and use that link in the syntax for the image to show on your notebook. Images on your computer and Google Drive(Private) will not be displayed.

A: You can render it as code using `URL`

Q5: What is the best way to solve indentation problems?

A: Two suggestions to solve indentation issues-

  • Type each line carefully making sure it is properly indented. Don’t copy paste code.

  • Create small functions with not more than 7-10 lines of code, so you won’t even face any indentation issues.

Q6: What does join() do?

A: The join() method takes all items in an iterable and joins them into one string.

Input:

names = ["John", "Peter", "Vicky"]
separator = '#'
x = separator.join(names)
print(x)

Output:

John#Peter#Vicky

Learn more: https://www.w3schools.com/python/ref_string_join.asp

Q7 : Can you explain the following- Input: int(True) Output: 1?

A: In Python 3.x, True and False are keywords and by default, will be equal to 1 and 0.

Q8: Difference between and and & operation?

A: and is for logical operations and & is for bit wise operations. Hence in pandas or numpy we use & while in statements where we talk about boolean over whole list (such as in set theory) we use and. and operates on lists but not on arrays where as & operates on arrays but not on lists.

Q9: Does the order of conditions matters when we are using and or or (& or |) logical/bitwise operators?

A: Yes, the order of conditions matters.

Q10: What is the difference between lists, tuples and sets in Python?

A: Lists, tuples and sets are built-in data structures in Python.

  • List

    • Ordered collection of data points in square brackets [], separated by commas.
    • Can store any type any data type or combination of data types.
    • Lists are mutable.
    • Elements in a list need not be unique and can be repeated.
  • Tuple

    • Ordered collection of data points in parenthesis (), separated by commas.
    • Can store any type any data type or combination of data types.
    • Tuples are immutable and it is one of the identifying features of tuples.
    • Elements in a list need not be unique and can be repeated.
  • Set

    • Unordered collection of data points in curly brackets {}, separated by commas.
    • Sets are mutable, however, only immutable objects can be stored in it.
    • Elements in a set are unique.
    • As no order is associated to sets, this data type does not support slicing or indexing.

It is to be noted that as tuples are immutable, any functions that change a collection of data points such as .append(), .remove(), .pop() etc. are not applicable on tuples.