100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Midterm cheat-sheet

Rating
-
Sold
1
Pages
5
Uploaded on
17-07-2024
Written in
2023/2024

This document contains the cheat-sheet used during the midterm exam. Using this cheat-sheet I obtained a grade of 8/10 for my midterm. I advise you to use this cheat-sheet as a reference and put it in your own words.

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
July 17, 2024
File latest updated on
July 17, 2024
Number of pages
5
Written in
2023/2024
Type
Summary

Subjects

Content preview

Indexing and range (starting from 0 by default)
○ [start (inclusive) : end (exclusive) : stepsize (optional)] = [0, 1, 2, 3] = [-4, -3, -2, -1]. Tip: end - start is the number of elements returned
○ Range(start (inclusive), stop (exclusive), stepsize). Range(3): 0, 1, 2. The start, stop and step parameters work the same as in list slicing.
○ Set function is used to create a set, particularly useful for removing duplicates from a list or character returns as { }.

Slicing (for lists, strings and tuples)
○ To copy a list in Python and ensure that changes to the new list do not affect the original list, you can use the list( ) or copy( ) functions, or
create a copy of a list by slicing it from the beginning to the end x[ : ] or x[ : : ]. Do not use the equal to sign to copy lists.
○ With positive steps you go from the start index to the right, with negative steps you go from the end to the left.
○ [ : : -1] reverses the list. [ : index] starts from index zero. [index : ] ends at, including the last element.

Importing packages – import package (as nickname). If you want to make your import more selective use – from package import function.

Functions
○ A function in Python is an object that encapsulates executable code, which can
be invoked by its name. Functions are defined with parameters in their headers,
and when called, arguments are passed to these parameters.
○ It may return a value using a return statement; if no return statement is
executed, None is returned by default.
○ Python fills any explicitly defined parameters first with the provided arguments.
$7.18
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
EBEdocuments
4.5
(2)

Also available in package deal

Get to know the seller

Seller avatar
EBEdocuments Universiteit van Amsterdam
Follow You need to be logged in order to follow users or courses
Sold
7
Member since
5 year
Number of followers
5
Documents
20
Last sold
7 months ago

4.5

2 reviews

5
1
4
1
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions