Back to marketplace

DataCamp: Python Basics - Functions

No description yet. This curated deck is ready for daily study.

Total cards: 18•Content version: v3•Public deck•Updated: 8/1/2026

Card preview (18)

#1
Front (Question)

get the length of a string

Back (Answer)

len(stringVar)

#2
Front (Question)

get definition of a function

Back (Answer)

help(funcName) or ?funcName

#3
Front (Question)

What shows that an argument is optional?

Back (Answer)

Brackets. Complex(real [, imag]) (imag is optional)

#4
Front (Question)

specify which args you’re passing (eg, if you’re skipping an arg and need to be specific)

Back (Answer)

function(arg1=2, arg3=5) (skipped arg2)

#5
Front (Question)

What is a method?

Back (Answer)

Method is called on an object, and can access the data in that object

#6
Front (Question)

upper case, lower case string methods

Back (Answer)

str.upper(), str.lower()

#7
Front (Question)

Count the instances of a substring in a string

Back (Answer)

string.count(“xxx”)»_space; counts number of “xxx” in string (case sensitive)

#8
Front (Question)

return the index of the element 19 in a list

Back (Answer)

list.index(19)

#9
Front (Question)

count the number of times 5 appears in a list

Back (Answer)

list.count(5)

#10
Front (Question)

List methods to append, remove and reverse

Back (Answer)

list.append(), list.remove(), list.reverse()

#11
Front (Question)

what is a python package

Back (Answer)

Directory of scripts you can use

#12
Front (Question)

What is each script in a package called?

Back (Answer)

Module

#13
Front (Question)

What is a python package to help manage packages?

Back (Answer)

pip

#14
Front (Question)

Once you have pip, how do you install a package?

Back (Answer)

pip3 install package

#15
Front (Question)

To use a package in your script, or a method in the package

Back (Answer)

import packageName as pN

#16
Front (Question)

How do you use function1 from imported package?

Back (Answer)

package.function1()

#17
Front (Question)

How do you import just function1 from package

Back (Answer)

from package import function1

#18
Front (Question)

how do you import a subpackage

Back (Answer)

import package.subpackage