Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Cheat sheet python code

Rating
-
Sold
-
Pages
2
Uploaded on
28-10-2021
Written in
2021/2022

Usefull python operations summarized in one file. Perhaps handy when you easily forget how to work on strings and lists during exam.

Institution
Course

Content preview

Common operations

October 28, 2021


0.1 String operations
• upper() - returns a string in uppercase
• lower() - returns a string in lowercase
• len() - returns the length of a string
• count() - returns the number of occurrences of a string within another string
• replace() - returns a string with specific text replaced
• find() - return the first position where a substring is found, or -1 if it is not found
• strip() - returns a string with all leading and trailing whitespace removed

0.2 Sequence operations
• x in s - true if an item of s is equal to x, else false
• x not in s - false if an item of s is equal to x, else true
• s[i] - ith itom of s, origin 0
• s[i:j] - slice of s from i to j
• s[i:j:k] - slice of s from i to j with step k

0.3 Comparisons
• < - strictly less than
• <= - less than or equal
• > - strictly greater than
• >= - greater than or equal
• == - equal
• != - not equal
• is - object identity
• is not - negated object identity

0.4 Numeric operations
• x+y - sum of x and y
• x-y - difference of x and y
• x*y - product of x and y
• x/y - quotient of x and y
• x//y - floored quotient of x and y
• x%y - remainder of x/y
• int(x) - x converted to integer
• float(x) - x converted to floating point
• x**y - x to the power y

1

Written for

Institution
Study
Course

Document information

Uploaded on
October 28, 2021
Number of pages
2
Written in
2021/2022
Type
SUMMARY

Subjects

$4.16
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
HappyLearning Radboud Universiteit Nijmegen
Follow You need to be logged in order to follow users or courses
Sold
62
Member since
5 year
Number of followers
45
Documents
10
Last sold
3 weeks ago

4.3

9 reviews

5
5
4
3
3
0
2
1
1
0

Trending documents

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