Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Samenvatting

Computer Science 114 Summary

Beoordeling
3.0
(1)
Verkocht
2
Pagina's
5
Geüpload op
10-08-2023
Geschreven in
2023/2024

Complete summary and guide to Computer Science 114, 1st year, 1st semester module. Includes a summary of all content covered as well as important pieces of code which are examined. The ultimate summary to succeed in computer science.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

Computer Science Notes CS 114
Strings
General

string[x] - returns the character at that position in the string.

string[0:2] - returns the 1st and 2nd characters [incl. : excl.]

string[1:len(string)-1] - returns the middle of the string

len(string) - returns the length of the string. (cat = 3)

+ - concatenate string.

== - checks if the strings are the same.

.contains(str) - checks if a string contains a certain string

.index(str) - returns the position of the character in the string



Manipulative Methods

.upper() - converts the string to uppercase

.lower() - converts the string to lowercase

.casefold() - converts string to lowercase, includes additional characters

.replace(old, new, count) - replaces certain characters in a string with the new input




Ethan Ganz 1

, Arithmetic
Functions

+ - addition

- - subtraction

/ - normal division ( = 2.5)

// - floor division (5 // 2 = 2)

* - multiplication

**2 - to the power of 2 (**5 = to the power of 5)

Note: - Considers order of operation

print(str(x) + ‘ ‘ + str(y)) - prints “x y” (x and y are integers or floats)



Methods

max(a, b, c) - returns the variable with the largest value.

min(a, b, c) - returns the variable with the smallest value.

abs(x) - returns the absolute value of x.

abs(x) % 10 - returns the last digit of the number.



Math class

math.sqrt() - returns the square root of a float

math.exp(a) - e to the power of a

math.log(a, b) - log a with base b

math.pi - pie

math.e -e (2.718281828459045…)



Random class

random.random - random float between [0, 1)

random.uniform(a, b) - random float between [a, b] (or [a, b) )

random.int(a, b) - random int between [a, b]

random.range(a, b, c) - random int between [a, b) within the increment c

random.shuffle(a) - shuffles array a randomly (works with 1D or 2D array)

random.gauss(a, b) - Gaussian distribution (a = mu, b = sigma)


Ethan Ganz 2

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
10 augustus 2023
Aantal pagina's
5
Geschreven in
2023/2024
Type
SAMENVATTING

Onderwerpen

$5.04
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
ethanganz
3.0
(1)

Beoordelingen van geverifieerde kopers

Alle reviews worden weergegeven
2 jaar geleden

3.0

1 beoordelingen

5
0
4
0
3
1
2
0
1
0
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
ethanganz Stellenbosch University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
2
Lid sinds
4 jaar
Aantal volgers
1
Documenten
2
Laatst verkocht
1 jaar geleden

3.0

1 beoordelingen

5
0
4
0
3
1
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen