100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary computer science alevel ocr notes questions answers and project!

Rating
-
Sold
-
Pages
7
Uploaded on
15-02-2023
Written in
2022/2023

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!!!!










Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
February 15, 2023
Number of pages
7
Written in
2022/2023
Type
Summary

Subjects

Content preview

#ITERATION CODING

#INSTRUCTIONS

# 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(" ")




def question2Input():

, x = int(input("Enter a number : "))
return x


def question2Main():
numberOfTimes = question2Input()
question2(numberOfTimes)
#question2Main()




######################################################
# 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)
£5.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
adnanabedin

Get to know the seller

Seller avatar
adnanabedin Queen Mary, University of London
View profile
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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 exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight 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 smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions