100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary OCR EXAM REFERENCE LANGUAGE TO PYTHON GUIDE - BY CSandRS £2.99   Add to cart

Summary

Summary OCR EXAM REFERENCE LANGUAGE TO PYTHON GUIDE - BY CSandRS

 12 views  0 purchase

Contains all the exam reference langugae alongside how to write the same in python. For J277 OCR GCSE. I have made this using every revision material possible including yt channels like Mr Brown CS, craig n dave and the actual OCR textbook. For context I attained grade 9 in 2024 for CS.

Preview 1 out of 2  pages

  • November 18, 2023
  • 2
  • 2023/2024
  • Summary
All documents for this subject (217)
avatar-seller
CSandRS
PYTHON OCR REFERENCE LANGUAGE
SELECTION
If/elseif
if pi == 3.14: if pi == 3.14 then
print(“Good”) print("Good")
elif pi == 3: elseif pi == 3 then
print(“ok...”) print("ok...")
else: else
print(“wrong!”) print("wrong!")
endif
Switch/case
match name: switch name:
case "1": case "1":
print("1") print("1")
case "2": case "2":
print("2") print("2")
case default: default:
print("????") print("????")
endswitch
ITERATION
FOR (count-controlled)
for count in range(1,11,2): for count = 1 to 10 step 2
# 11 is exclusive print(count)
print(count) next count
WHILE (condition controlled) - pre-check. Might never run
while continue == “Y” While continue == “Y”
continue = input(“continue?”) continue = input(“continue?”)
endwhile
DO…UNTIL (condition controlled) - post-check. Will run at least once
do
continue = input(“continue?”)
until continue == “N”
STRING MANIPULATION text = “Hello”
What it does PYTHON ERL Return: “Hello”
Count the number of characters in a len(text) text.length 5
string
Extract characters from a string text[1:5] [x:y]: text.substring[1:4] [x:y]: ello
x: first character x: first character
y: last (exclusive) y: number of characters incl x
Slice characters from left/right - text.left(2) / text.right(2) He / lo
Convert string to UPPERCASE text.upper() text.upper HELLO
Convert string to LOWERCASE text.lower() text.lower hello
Concatenate/Join strings + + -
Finds ASCII value of the character ord(“A”) ASC(A) 65
Finds the character corresponding to chr(65) CHR(65) A
the ASCII value

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 credit card 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 these notes from?

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

Will I be stuck with a subscription?

No, you only buy these notes for £2.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

82956 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 14 years now

Start selling
£2.99
  • (0)
  Add to cart