Summary computer science alevel ocr notes questions answers and project!
19 views 0 purchase
Course
Computer science revision notes
Institution
OCR
This is perfect as it has revision notes, summary notes, detailed notes and even questions and answer. Also a BONUS of example programming projects such as programming a calculator. Worth it!!!!
# 1) COMPLETE QUESTIONS THAT ARE IN A RED BOX
# 2) DO NOT CHANGE THE MAIN METHOD NAMES!!!!!
# 3) READ COMMENTS FOR HELP
# 4) DELETE "RETURN" KEYWORD IN SOME PLACES
# 5) MAKE SURE THERE ARE NO SYNTAX ERRORS WHEN YOU UPLOAD!!!!
######################################################
# Question 1: Write a function that prints takes a string from a user and print this as many
times the user has specified
######################################################
def question1():
stringInput = input ("Enter a string of your choice : ")
numberOfTimes = int(input("How many times would you like to print this ? "))
return stringInput, numberOfTimes
def question1Main():
x,y = question1()
for i in range (y):
print(x)
#question1Main()
#####################################################
# Question 2: Write a function that takes in a number from the user e.g. 5 and prints the
following pattern If the user enters 5 the following patern would be:
# 1
# 12
# 123
# 1234
# 12345
######################################################
def question2(numberOfTimes):
for i in range(1,numberOfTimes+1):
for j in range(1,i+1):
print(j,end = " " )
print(" ")
######################################################
# Question 3: Write a function that calculates the sum of all numbers from 1 to a given
number
######################################################
def question3(x):
sum = 0
i=0
while i<=x :
sum = sum+i
i+= 1
return sum
def question3Input():
number = int(input("Enter a number >1 : "))
return number
def question3Main():
x = question3Input()
sumNumber = question3(x)
print(sumNumber)
#question3Main()
######################################################
# Question 5: Write a program to print multiplication table of a given number
######################################################
def question5(number):
print("Multiplication table for : ", number)
for i in range(1,11) :
print(number,"x",i,"=", number*i)
The benefits of buying summaries with Stuvia:
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
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
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 adnanabedin. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.84. You're not tied to anything after your purchase.