Moduule 2 | Introduction to Python and Jupyter Notebooks

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/106

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:48 PM on 1/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

107 Terms

1
New cards

An interactive platform where you can write code, add text, and create visualizations.

Jupyter Notebook

2
New cards

The name "Jupyter" is a loose acronym originally referring to these three programming languages.

Julia, Python, R

3
New cards

True or False:

In addition to Julia, Python, and R, Jupyter now supports languages such as Ruby, Haskell, Scala, and Go.

True

4
New cards

Jupyter Notebook can be accessed through this tool or directly by launching the Jupyter application.

Anaconda Navigator

5
New cards

The first page that appears when Jupyter Notebook opens in a browser is called the…

Landing page

6
New cards

By default, the type of a Jupyter Notebook cell used for typing code is called…

Code cell

7
New cards

In Jupyter Notebook, pressing Shift+Enter on a code cell will…

Execute the code and create a new code cell

8
New cards

In Jupyter Notebook, pressing Ctrl+Enter (Windows) or Cmd+Enter (Mac) will…

Execute the code without creating a new cell

9
New cards

In a code cell, you can write explanations about your code using…

Comments (preceded by #)

10
New cards

If you want to write headings, subheadings, or long text in a notebook, you should use…

Markdown cell

11
New cards

In Jupyter Notebook, you can change a cell type from the dropdown menu located under…

Widgets tab

12
New cards

To give a notebook a custom name, you should click on…

The text that says ‘Untitled’

13
New cards

The default file extension for a Jupyter Notebook is…

.ipynb

14
New cards

In Python, everything such as numbers, strings, functions, classes, and modules exists as…

Objects

15
New cards

A value associated with an object and defined within its class is called…

Attribute

16
New cards

A function associated with an object, which can access the object's attributes, is called…

Method

17
New cards

For a variable var = 2, which of the following are its attributes in Python?

real and imag

18
New cards

In Python, to see all attributes and methods associated with an object obj, you can…

Type obj. and press Tab

19
New cards

In Python, a class defines…

The blueprint for objects

20
New cards

In Python OOP, the relationship between attributes, methods, and objects is defined in the…

Class

21
New cards

In Python, when a variable is assigned an object, the variable acts as a…

Reference to the object

22
New cards

The Python system that handles variable assignments and object references is called…

Call by Object Reference

23
New cards

After executing y.append(4) when y = x and x = [5,3], the value of x is…

[5,3,4]

24
New cards

The behavior where multiple variable names point to the same object and changes via one variable affect the others is called…

Call by reference

25
New cards

In Python, lists and most mutable objects demonstrate this assignment behavior.

Call by Object Reference

26
New cards

When a new variable is assigned an existing object, the object is…

Not copied, just referenced

27
New cards

To create a completely independent copy of a list instead of referencing the same object, you would use…

list.copy() or slicing

28
New cards

In Python, multiple variables can be assigned values in a single statement by separating variable names and values with…

Commas

29
New cards

Example of assigning multiple values to multiple variables in one line:

color1, color2, color3 = "red", "green", "blue"

30
New cards

The same value can be assigned to multiple variables in a single statement using…

Chained assignment

31
New cards

Example of assigning the same value to multiple variables at once:

x = y = z = 10

32
New cards

Multiple assignment in Python helps to…

Reduce code lines and initialize several variables at once

33
New cards

A valid Python variable name must start with…

A letter or underscore (_)

34
New cards

Which of the following characters are allowed in Python variable names?

Letters, digits, and underscores

35
New cards

Python variable names are…

Case-sensitive

36
New cards

Which of the following is a valid variable name in Python?

my_favorite_car

37
New cards

Assigning a value to a variable = 23 in Python will produce…

Syntax error

38
New cards

The term that refers to the rules governing the structure of valid statements in a programming language is called…

Syntax

39
New cards

Which of the following variable names is invalid in Python?

3_musketeers

40
New cards

In Python, a variable is created when a value is assigned to it, without explicitly defining its type. This behavior is called…

Dynamically typed

41
New cards

To find the data type of a Python variable, which built-in function is used?

type()

42
New cards

The type of the variable a_variable = 23 is…

int

43
New cards

The type of the variable is_today_Saturday = False is…

bool

44
New cards

The type of the variable my_favorite_car = 'Delorean'

str

45
New cards

The type of the variable the_3_musketeers = ['Athos', 'Porthos', 'Aramis'] is…

list

46
New cards

Primitive data types in Python represent a single value. Which of the following are primitive data types?

Integer, float, boolean, None, string

47
New cards

Data types that can hold multiple pieces of data together, like list, tuple, and dictionary, are called…

Containers

48
New cards

The type of 4.4 in Python is…

float

49
New cards

The type of '4' in Python is…

str

50
New cards

Functions in Python that are available without importing any library or module are called…

Built-in functions

51
New cards

The extensive collection of standard modules and scripts available in Python is called…

Python Standard Library

52
New cards

The Python function range() is commonly used to…

Generate a sequence of evenly spaced integers

53
New cards

Example of using range() to create numbers from 1 to 9:

list(range(1,10))

54
New cards

The Python module used for handling date and time objects is…

datetime

55
New cards

To create a datetime object representing September 20, 2022, at 11:30:00, you can use…

dt.datetime(2022, 9, 20, 11, 30, 0)

56
New cards

The day of a datetime object dt_object can be accessed using…

dt_object.day

57
New cards

The year of a datetime object dt_object can be accessed using…

dt_object.year

58
New cards

The strftime method in Python’s datetime module is used to…

Format a datetime object as a string

59
New cards

Example of formatting a datetime object as '09/20/2022' is…

dt_object.strftime('%m/%d/%Y')

60
New cards

Example of formatting a datetime object as '09/20/22 11:30' is…

dt_object.strftime('%m/%d/%y %H:%M')

61
New cards

Functions like print(), abs(), max(), and sum() are available in Python…

Without importing any library

62
New cards

The Python library primarily used for numerical computing with arrays and matrices is…

NumPy

63
New cards

Which library provides DataFrame and Series data structures for data manipulation?

Pandas

64
New cards

Python libraries commonly used for data visualization include…

Matplotlib and Seaborn

65
New cards

The Python library used for scientific computing such as solving differential equations and optimization is…

SciPy

66
New cards

The Python library primarily used for machine learning tasks like classification, regression, and clustering is…

Scikit-learn

67
New cards

Statsmodels in Python is mainly used for…

Statistical modeling and inference

68
New cards

To import an entire library and give it a shorter alias, you can use…

import numpy as np

69
New cards

To import only specific functions or classes from a library, you can use…

from random import randint

70
New cards

After importing a library with an alias (e.g., import numpy as np), functions from that library are accessed using…

np. prefix

71
New cards

A reusable set of instructions in Python that takes inputs, performs operations, and often returns an output is called…

Function

72
New cards

Functions provided by Python’s standard library or external libraries are called…

Pre-defined functions

73
New cards

Functions that are created by the programmer to perform specific tasks are called…

User-defined functions

74
New cards

The keyword used to define a function in Python is…

def

75
New cards

Pre-defined functions are not sufficient when…

You need to perform a specific task not covered by existing functions

76
New cards

In Python function syntax, which of the following are essential after the function name?

Parentheses () and colon :

77
New cards

The statements inside a Python function are executed when…

The function is called

78
New cards

A function that takes an input parameter and uses it in the body is defined as:

def say_hello_to(name):

79
New cards

Trying to access a local variable outside its function will result in…

NameError

80
New cards

Global variables in Python are…

Declared outside a function and accessible inside and outside functions

81
New cards

Invoking a function with specific parameter names to improve clarity is called…

Using named arguments

82
New cards

In Python, a function argument that can be omitted in a function call and uses a default value if not provided is called…

Optional argument

83
New cards

In Python, *args is used to pass…

A variable number of non-keyword arguments

84
New cards

In Python, **kwargs is used to pass…

A variable number of keyword arguments

85
New cards

The special symbols used for passing an unknown number of arguments to a function are…

*args and **kwargs

86
New cards

In Python, the statement used to execute a block of code only if a condition is True is…

if

87
New cards

The else statement in Python is executed when…

The if condition evaluates to False

88
New cards

The elif statement in Python is used to…

Check multiple conditions in sequence

89
New cards

In an if-elif-else chain, how many blocks are executed?

At most one

90
New cards

Indentation in Python is used to…

Define the scope of code blocks

91
New cards

Which of the following values is considered “falsy” in Python?

0

92
New cards

Which of the following values is considered “truthy” in Python?

[1, 2, 3]

93
New cards

Python allows conditions that are not strictly boolean. Such conditions are automatically converted using…

bool()

94
New cards

The pass statement in Python is used to…

Do nothing in a block when a statement is syntactically required

95
New cards

A Python loop that executes a block of code repeatedly as long as a condition is True is called…

while loop

96
New cards

Which statement is not required in a while loop but commonly used to avoid infinite loops?

Updating a loop variable

97
New cards

A loop in Python that never ends because its condition always evaluates to True is called…

Infinite loop

98
New cards

How can you stop an infinite loop in Jupyter Notebook?

Press the Stop button or select Kernel > Interrupt

99
New cards

The break statement in Python is used to…

Immediately exit the loop

100
New cards

The continue statement in Python is used to…

Skip the current iteration and move to the next

Explore top notes

note
La amortajada
Updated 886d ago
0.0(0)
note
Vocab Set 1
Updated 189d ago
0.0(0)
note
BIOLOGIA 5 - IHMISEN BIOLOGIA
Updated 571d ago
0.0(0)
note
Misplaced Modifiers
Updated 1195d ago
0.0(0)
note
La amortajada
Updated 886d ago
0.0(0)
note
Vocab Set 1
Updated 189d ago
0.0(0)
note
BIOLOGIA 5 - IHMISEN BIOLOGIA
Updated 571d ago
0.0(0)
note
Misplaced Modifiers
Updated 1195d ago
0.0(0)

Explore top flashcards

flashcards
MICROBIOLOGY EXAM 4
30
Updated 500d ago
0.0(0)
flashcards
4.2
70
Updated 980d ago
0.0(0)
flashcards
Animal Scientific Names
22
Updated 1169d ago
0.0(0)
flashcards
AP LANG RHETORICAL CHOICES
26
Updated 977d ago
0.0(0)
flashcards
Language of Anatomy
48
Updated 1229d ago
0.0(0)
flashcards
MICROBIOLOGY EXAM 4
30
Updated 500d ago
0.0(0)
flashcards
4.2
70
Updated 980d ago
0.0(0)
flashcards
Animal Scientific Names
22
Updated 1169d ago
0.0(0)
flashcards
AP LANG RHETORICAL CHOICES
26
Updated 977d ago
0.0(0)
flashcards
Language of Anatomy
48
Updated 1229d ago
0.0(0)