100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Computer Science 114 Summary R80,00   Add to cart

Summary

Computer Science 114 Summary

1 review
 111 views  1 purchase

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.

Preview 2 out of 5  pages

  • August 10, 2023
  • 5
  • 2023/2024
  • Summary
All documents for this subject (5)

1  review

review-writer-avatar

By: ndemangokholo • 5 months ago

avatar-seller
ethanganz
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller ethanganz. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R80,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80189 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R80,00  1x  sold
  • (1)
  Buy now