jackymang12345
Badges: 5
Rep:
?
#1
Report Thread starter 3 years ago
#1
Hi

I am looking online of how to write a pseudocode and apparently it's meant to be straightforward, but clearly I'm not finding it. I've got my coding and am wondering if anyone can help with anything that can lead me to get my pseudocode result.
It can be anything from what I have to include or not include etc. Or maybe a clear example of your own. If anyone is willing to look at my coding and help with doing a pseudocode that will be great!

Thanks
0
reply
2190243
Badges: 3
Rep:
?
#2
Report 3 years ago
#2
If you upload your work we can help (as long as its not breaking any rules)
0
reply
catinsomehat
Badges: 15
Rep:
?
#3
Report 3 years ago
#3
Pseudo:
"adjective
1. not actually but having the appearance of; pretended; false or spurious; sham.
2. almost, approaching, or trying to be."

Pseudocode can look like whatever you want it to look like, it just needs to make sense and convey the ideas to another person. It's basically what people use to create a template and brainstorm ideas before actually coding something. It's not something that's going to run if compiled.
Your lecturer may have a preference for writing it in a certain way so you'd need to ask if that's the case.

It's not a real language or syntax but you just need to be consistent in how you write it.

Click the play button for the video to play: https://www.khanacademy.org/computin...th-pseudo-code

https://www.youtube.com/watch?v=lbWxstGMGuk

If you want to go from algorithm to pseudocode to code: https://www.youtube.com/watch?v=Q13YfIFSGmk
0
reply
Potatoo
Badges: 10
Rep:
?
#4
Report 3 years ago
#4
It just has to make sense but it shouldn't be code
Eg. in visual studio you'd write: FirstName= InputBox("Enter a name")
For pseudocode it'd be just : TAKE in FirstNameFROMKEYBOARD
0
reply
s4b3rt00th
Badges: 11
Rep:
?
#5
Report 3 years ago
#5
Why would you want to convert your code into pseudo code if you have already done the code? Pseudo code is not actual code, which can compile but rather it is "fake" code. It's part of what you do in order to design your program. Keep in mind that there is no standard way in writing pseudo code. You can write it out however you want but it has to resemble actual code and must make sense.

Here's an example of pseudo code:


START

--- INPUT number (integer value);

--- IF number is less than 0:
------ PRINT (number + "is less than zero";
--- ELSE number is more than 0:
------ PRINT (number + "is more than zero";

END
Replace the emoticons with ). The dashes are indentations because I can't indent here for some odd reason.
1
reply
jackymang12345
Badges: 5
Rep:
?
#6
Report Thread starter 3 years ago
#6
Ok thanks for your help guys. Kind of makes sense. Basically, whatever the coding is about to do and means, I put it in simple language right. I also change my variable names too.

This is one of my code lines, it may not make sense to you as its coursework, but can someone help to put it how you would:

gtin8_number_string= '1235789'
barcode_number_string = int(1+3+7+9)*3 + int(2+5+8)*1
print (barcode_number_string)

Thank You
0
reply
jackymang12345
Badges: 5
Rep:
?
#7
Report Thread starter 3 years ago
#7
"Why would you want to convert your code into pseudo code if you have already done the code? Pseudo code is not actual code, which can compile but rather it is "fake" code. It's part of what you do in order to design your program. Keep in mind that there is no standard way in writing pseudo code. You can write it out however you want but it has to resemble actual code and must make sense."

Ok Thank you can you send me the example work before doing the pseudo code so I can see the difference?

Thanks
0
reply
catinsomehat
Badges: 15
Rep:
?
#8
Report 3 years ago
#8
(Original post by jackymang12345)
"Why would you want to convert your code into pseudo code if you have already done the code? Pseudo code is not actual code, which can compile but rather it is "fake" code. It's part of what you do in order to design your program. Keep in mind that there is no standard way in writing pseudo code. You can write it out however you want but it has to resemble actual code and must make sense."Ok Thank you can you send me the example work before doing the pseudo code so I can see the difference?Thanks
A simple example of pseudocode:

Pseudocode:
Code:
PRINT "Printing..." 10 times
Real code:
Code:
for (i = 0; i < 10; i++);
{
Console.WriteLine("Printing...");
}
From your code it looks like you could write it along the lines of:
Code:
Set variable gtin8_number_string to '1235789'

Add integers 1, 3, 7, 9 together then multiply by 3
Add integers 2, 5, 8 together then multiply by 1
Add final result of previous two lines together then save in variable barcode_number_string

Print barcode_number_string
I'd just like to add that you're saving the values from int(1+3+7+9)*3 + int(2+5+8)*1 in a variable that's called barcode_number_string but I think these would probably be saved as integers (just check). You might need to change them into a string afterwards if that's the case (using ' or " ) if the barcode_number_string needs to actually be a string.
If you need help with that let me know.

You might want to use double quotes ( " ) instead of single quotes ( ' ) by the way when using strings, this is much better practice, because ' implies char not string, at least to me There doesn't seem to be much difference in python but google to check.
0
reply
jackymang12345
Badges: 5
Rep:
?
#9
Report Thread starter 3 years ago
#9
Oh wow! Thank You so much. Out of everything this really helped me understand how to do it. I guess it's seeing my own coursework in Pseudocode that helped me get it rather than loads of others. If I get stuck later, do you have an email I can message you on or on this page is fine.

Thank You it really helped
0
reply
s4b3rt00th
Badges: 11
Rep:
?
#10
Report 3 years ago
#10
(Original post by jackymang12345)
Ok Thank you can you send me the example work before doing the pseudo code so I can see the difference?

Thanks
You do the pseudo code before you write actual code. Pseudo code is in the design and planning stage. You do not design and plan after. If you are asking me to convert the pseudo code into compilable code then here it is:


number = input("Enter a number."
number = int(number);

if number < 0:
--- print (number);
--- print ("number is less than 0.";
else:
--- print (number);
--- print ("number is more than 0.";
I realised my programming skill is very rusty.

---

I'm in year 10 and I'm confused. I'm going to presume you are in year 10 too. Why aren't you doing the same coursework as me?

---

(Original post by catinsomehat)
You might want to use double quotes ( " ) instead of single quotes ( ' ) by the way when using strings, this is much better practice, because ' implies char not string, at least to me
What's the difference between char and string? And, how did you write your code like that?
0
reply
jackymang12345
Badges: 5
Rep:
?
#11
Report Thread starter 3 years ago
#11
"You do the pseudo code before you write actual code. Pseudo code is in the design and planning stage. You do not design and plan after. If you are asking me to convert the pseudo code into compilable code then here it is:"



I know but I don't know why we got told and are doing after?! What coursework are you doing btw?
0
reply
s4b3rt00th
Badges: 11
Rep:
?
#12
Report 3 years ago
#12
(Original post by jackymang12345)
I know but I don't know why we got told and are doing after?! What coursework are you doing btw?
I blame lazy teachers not covering everything that needs to be covered before going into the coursework.

I am doing text compression. How about you?
0
reply
jackymang12345
Badges: 5
Rep:
?
#13
Report Thread starter 3 years ago
#13
Exactly! Not helpful at all! I have to do it over these summer holidays and with no teacher its really hard.

I'm doing something totally different in Python!
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

University open days

  • University of Bristol
    Undergraduate Open Afternoon Undergraduate
    Wed, 23 Oct '19
  • University of Exeter
    Undergraduate Open Day - Penryn Campus Undergraduate
    Wed, 23 Oct '19
  • University of Nottingham
    Mini Open Day Undergraduate
    Wed, 23 Oct '19

Have you made up your mind on your five uni choices?

Yes I know where I'm applying (154)
59.46%
No I haven't decided yet (60)
23.17%
Yes but I might change my mind (45)
17.37%

Watched Threads

View All