Help me with my computer science plz.

Watch this thread
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#1
Report Thread starter 2 years ago
#1
Write pseudocode for a program that prints 5 lines in the pattern shown below.
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
0
reply
EKGreb
Badges: 4
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#2
Report 2 years ago
#2
(Original post by learner38)
Write pseudocode for a program that prints 5 lines in the pattern shown below.
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
DId it ask for a for loop or anything like that if not ill write it for you now but my pseudocode is pretty terrible
0
reply
Blue_Cow
Badges: 22
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#3
Report 2 years ago
#3
(Original post by learner38)
Write pseudocode for a program that prints 5 lines in the pattern shown below.
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
Show us your attempt. Pseudocode has no syntax, just show some basic understanding using plain English.
Last edited by Blue_Cow; 2 years ago
0
reply
EKGreb
Badges: 4
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#4
Report 2 years ago
#4
(Original post by EKGreb)
DId it ask for a for loop or anything like that if not ill write it for you now but my pseudocode is pretty terrible
#A variable has to be defined before use
Xs = ("X")
#After a variable has been defined it can be printed
print (Xs)
#Redifining the variable allows another x to be added each time
Xs = ("XXX")
print (Xs)
Xs = ("XXXXX")
print (Xs)
Xs = ("XXXXXXX")
print (Xs)
0
reply
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#5
Report Thread starter 2 years ago
#5
(Original post by EKGreb)
DId it ask for a for loop or anything like that if not ill write it for you now but my pseudocode is pretty terrible
No it didnt
0
reply
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#6
Report Thread starter 2 years ago
#6
THANK YOU EVERYONE I didn’t think it was this simple. I overthought it.
0
reply
username3093384
Badges: 18
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#7
Report 2 years ago
#7
letter = "X"
lines = 5
currentLines = 0
while(lines != currentLines):
print(letter)
letter += "XX"
currentLines+=1

Efficient, can work for as many lines as you want
1
reply
username3093384
Badges: 18
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#8
Report 2 years ago
#8
I've seen the other answers being just print statements, I assure you that's not what they want.
0
reply
username3093384
Badges: 18
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#9
Report 2 years ago
#9
(Original post by learner38)
THANK YOU EVERYONE I didn’t think it was this simple. I overthought it.
You are right, it's not just meant to be print statements. See by answer above
1
reply
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#10
Report Thread starter 2 years ago
#10
(Original post by Hammad(214508))
You are right, it's not just meant to be print statements. See by answer above
Thank you.
(Original post by Hammad(214508))
letter = "X"
lines = 5
currentLines = 0
while(lines != currentLines):
print(letter)
letter += "XX"
currentLines+=1

Efficient, can work for as many lines as you want
Thank you soo much
0
reply
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#11
Report Thread starter 2 years ago
#11
Can someone help me with another question. It’s a pseudocode.

Star=1
While star < 5
Write(“*”)
Next n
Writeline
Star=star 1
Endwhile

What will be the output?
Last edited by Learner777; 2 years ago
0
reply
username3093384
Badges: 18
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#12
Report 2 years ago
#12
(Original post by learner38)
Can someone help me with another question. It’s a pseudocode.

Star=1
While star < 5
Write(“*”)
Next n
Writeline
Star=star 1
Endwhile

What will be the output?
*
**
***
****
I assume it is this, your code looks very confusing
0
reply
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#13
Report Thread starter 2 years ago
#13
(Original post by Hammad(214508))
*
**
***
****
I assume it is this, your code looks very confusing
It’s a pseudocode and I didn’t make it. Thank youuu
0
reply
winterscoming
Badges: 19
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#14
Report 2 years ago
#14
(Original post by learner38)
It’s a pseudocode and I didn’t make it. Thank youuu
The real question is whether you really understand how to apply computational thinking skills to solve these problems for yourself? I would strongly recommend that you ignore all the answers you've been given in this thread and sit down to figure it out for yourself. You really need to practice finding these solutions by yourself otherwise you're going to have a difficult time in the exam, and from here onwards the programming problems you'll be faced with are only going to get more complicated.

Writing the actual Python or Pseudocode syntax is the easy part because that's something that you can memorise and find on Google; the hard part is the thought process which goes into analysing the problem, breaking the problem down, looking for patterns and trying to think about the steps which form the solution -- this isn't something that you can memorise and it's not something you can find on Google either; it's a new way of thinking and a skill that you need to learn, but you can only learn that skill and way of thinking through practice with solving problems like this. It just takes a bit of time but it will click if you give it a go.

The 'print' steps are actually a really useful starting point because they should show you the pattern that you need to implement and find a more generalised (abstract) way to solve, so that you can do the same thing for 'any' number of lines without needing to change the code.

If you are having trouble finding solutions to problems like this then you really need to practise finding these solutions for yourself otherwise you are going to have a very difficult time in the exam.

Have a look at some of these videos, they'll explain the kinds of methods you need to learn and how to approach any programming problem:
https://student.craigndave.org/videos/2-1-algorithms
Last edited by winterscoming; 2 years ago
0
reply
Learner777
Badges: 21
Rep:
? You'll earn badges for being active around the site. Rep gems come when your posts are rated by other community members.
#15
Report Thread starter 2 years ago
#15
(Original post by winterscoming)
The real question is whether you really understand how to apply computational thinking skills to solve these problems for yourself? I would strongly recommend that you ignore all the answers you've been given in this thread and sit down to figure it out for yourself. You really need to practice finding these solutions by yourself otherwise you're going to have a difficult time in the exam, and from here onwards the programming problems you'll be faced with are only going to get more complicated.

Writing the actual Python or Pseudocode syntax is the easy part because that's something that you can memorise and find on Google; the hard part is the thought process which goes into analysing the problem, breaking the problem down, looking for patterns and trying to think about the steps which form the solution -- this isn't something that you can memorise and it's not something you can find on Google either; it's a new way of thinking and a skill that you need to learn, but you can only learn that skill and way of thinking through practice with solving problems like this. It just takes a bit of time but it will click if you give it a go.

The 'print' steps are actually a really useful starting point because they should show you the pattern that you need to implement and find a more generalised (abstract) way to solve, so that you can do the same thing for 'any' number of lines without needing to change the code.

If you are having trouble finding solutions to problems like this then you really need to practise finding these solutions for yourself otherwise you are going to have a very difficult time in the exam.

Have a look at some of these videos, they'll explain the kinds of methods you need to learn and how to approach any programming problem:
https://student.craigndave.org/videos/2-1-algorithms
Omg you sound like my teacher but I shall revise these it’s because I’ve just learnt this topic
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Year 12s - where are you at with making decisions about university?

I’ve chosen my course and my university (10)
35.71%
I’ve chosen my course and shortlisted some universities (9)
32.14%
I’ve chosen my course, but not any universities (2)
7.14%
I’ve chosen my university, but not my course (1)
3.57%
I’ve shortlisted some universities, but not my course (2)
7.14%
I’m starting to consider my university options (3)
10.71%
I haven’t started thinking about university yet (0)
0%
I’m not planning on going to university (1)
3.57%

Watched Threads

View All