• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Generating pseudocode to track the daily temperature of a month.

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
So I am new to coding and in my class we are learning flow charts and pseudocode, I am currently tasked with several projects one of which is to generate a pseudocode to track the daily temperature of a month. I am having a hard time understanding how to do this, I know that this will not be syntax accurate and it is a logical direction. But when I view examples of pseudocode I can’t find one for tracking data like this, and am getting mixed understandings on how I should write it out. I did write out what I think is okay, but it clearly is bulky and hard to read. I have attached a photo, if anyone can help me make this look better I would appreciate it. Any advice will be greatly appreciated.
 

Attachments

  • image.jpg
    image.jpg
    1.7 MB · Views: 333

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,887 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
Ask your teacher for clarification?
 
Joined
Jul 9, 2016
Messages
1,068 (0.38/day)
System Name Main System
Processor i9-10940x
Motherboard MSI X299 Xpower Gaming AC
Cooling Noctua NH-D15S + Second Fan
Memory G.Skill 64GB @3200MHz XMP
Video Card(s) ASUS Strix RTX 3090 24GB
Storage 2TB Samsung 970 EVO Plus; 2TB Corsair Force MP600; 2TB Samsung PM981a
Display(s) Dell U4320Q; LG 43MU79-B
Case Corsair A540
Audio Device(s) Creative Lab SoundBlaster ZX-R
Power Supply EVGA G2 1300
Mouse Logitech MK550
Keyboard Corsair K95 Platinum XT Brown Switches
Software Windows 10 Pro
Benchmark Scores Cinebench R20 - 6910; FireStrike Ultra - 13241; TimeSpy Extreme - 10067; Port Royal - 13855
Have you learned data structures such as array?
 

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
We are learning that now. It was mentioned to a degree but was told we would learn more later in the book.

We are learning that now. It was mentioned to a degree but was told we would learn more later in the book.
I’m not very sure on how to use them yet I understand they can be used to “compress” a lot of variables into a more understanding line. But that is as far as I have learned. I’m looking for alternative sources to study along with my books. If you have any websites I can visit that would be greatly appreciated.
 
Joined
Jul 21, 2008
Messages
5,174 (0.90/day)
System Name [Daily Driver]
Processor [Ryzen 7 5800X3D]
Motherboard [Asus TUF GAMING X570-PLUS]
Cooling [be quiet! Dark Rock Slim]
Memory [64GB Corsair Vengeance LPX 3600MHz (16GBx4)]
Video Card(s) [PNY RTX 3070Ti XLR8]
Storage [1TB SN850 NVMe, 4TB 990 Pro NVMe, 2TB 870 EVO SSD, 2TB SA510 SSD]
Display(s) [2x 27" HP X27q at 1440p]
Case [Fractal Meshify-C]
Audio Device(s) [Steelseries Arctis Pro]
Power Supply [CORSAIR RMx 1000]
Mouse [Logitech G Pro Wireless]
Keyboard [Logitech G512 Carbon (GX-Brown)]
Software [Windows 11 64-Bit]
Code:
tempData = [];

tempData.push(dailyTemp);

avg = sum(tempData) / tempData.length;
max = max(tempData);
min = min(tempData);

I don't actually know what counts as "pseudocode".. So that's basically just JS simplified.

"[]" is an array, so for this example would be filled with [90, 87, 78, 90, etc, etc]

If you needed to be able to pull specific date data you'd be better off using an object to store the data with the actual date as the identifier.
 

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
Code:
tempData = [];

tempData.push(dailyTemp);

avg = sum(tempData) / tempData.length;
max = max(tempData);
min = min(tempData);

I don't actually know what counts as "pseudocode"
Wow this looks a lot better than mine haha I’m definitely a total noob at this. It might be asking a lot but can you explain each part of this in layman’s terms. I’m a hands on learner and the more something is broken down in detail the better I can understand it.
 
Joined
Jul 21, 2008
Messages
5,174 (0.90/day)
System Name [Daily Driver]
Processor [Ryzen 7 5800X3D]
Motherboard [Asus TUF GAMING X570-PLUS]
Cooling [be quiet! Dark Rock Slim]
Memory [64GB Corsair Vengeance LPX 3600MHz (16GBx4)]
Video Card(s) [PNY RTX 3070Ti XLR8]
Storage [1TB SN850 NVMe, 4TB 990 Pro NVMe, 2TB 870 EVO SSD, 2TB SA510 SSD]
Display(s) [2x 27" HP X27q at 1440p]
Case [Fractal Meshify-C]
Audio Device(s) [Steelseries Arctis Pro]
Power Supply [CORSAIR RMx 1000]
Mouse [Logitech G Pro Wireless]
Keyboard [Logitech G512 Carbon (GX-Brown)]
Software [Windows 11 64-Bit]
Code:
// This creates an empty array called tempData
tempData = [];

// This stores the current daily temp in the array (doesn't loop, assumes this code would be run for every day)
tempData.push(dailyTemp);

// A fake function "sum" adds all the entries in the array together, then divides it by the array length to get the average
avg = sum(tempData) / tempData.length;
// Fake function that finds the max
max = max(tempData);
// Fake function that finds the min
min = min(tempData);

Added some comments

I don't know if the teacher assumes this is a live recording thing or if it's using historical data. If you're using historical data you'd have to put the '.push' line in some type of loop (for/while/etc..) to store all the historical data into the array.. but then you'd also not even need the array, so I'd guess they're not looking for you to get that in depth with it.

I'm self taught so some of my early stuff looked a lot worse than what you've got :p
 

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
Code:
// This creates an empty array called tempData
tempData = [];

// This stores the current daily temp in the array (doesn't loop, assumes this code would be run for every day)
tempData.push(dailyTemp);

// A fake function "sum" adds all the entries in the array together, then divides it by the array length to get the average
avg = sum(tempData) / tempData.length;
// Fake function that finds the max
max = max(tempData);
// Fake function that finds the min
min = min(tempData);

Added some comments

I don't know if the teacher assumes this is a live recording thing or if it's using historical data. If you're using historical data you'd have to put the '.push' line in some type of loop (for/while/etc..) to store all the historical data into the array.. but then you'd also not even need the array, so I'd guess they're not looking for you to get that in depth with it.

I'm self taught so some of my early stuff looked a lot worse than what you've got :p
Wow thank you so much! This helps a lot! and thanks for the spiritual boost.
 
Joined
Mar 10, 2015
Messages
3,984 (1.20/day)
System Name Wut?
Processor 3900X
Motherboard ASRock Taichi X570
Cooling Water
Memory 32GB GSkill CL16 3600mhz
Video Card(s) Vega 56
Storage 2 x AData XPG 8200 Pro 1TB
Display(s) 3440 x 1440
Case Thermaltake Tower 900
Power Supply Seasonic Prime Ultra Platinum
Realistically, pseudo code is a human readable example of code. Such as getting out of bed:

Open eyes
Check clock
If weekend:
--> set alcohol to whiskey
Else:
--> set slcohol to tequila
While day sucks:
--> drink alcohol

If you submit code, your instructor is going to kick your ass.
 
Last edited:

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
Realistically, pseudo code is a human readable example of code. Such as getting out of bed:

Open eyes
Check clock
If weekend:
--> Open whiskey
Else:
--> Open tequila

If you submit code, your instructor is going to kick your ass.
Lol okay I’ll avoid getting my ass kicked then. So my pseudocode is bulky and too much. If I was to simplify it I could just say what the step is and not show every variable like I did?
 
Joined
Mar 10, 2015
Messages
3,984 (1.20/day)
System Name Wut?
Processor 3900X
Motherboard ASRock Taichi X570
Cooling Water
Memory 32GB GSkill CL16 3600mhz
Video Card(s) Vega 56
Storage 2 x AData XPG 8200 Pro 1TB
Display(s) 3440 x 1440
Case Thermaltake Tower 900
Power Supply Seasonic Prime Ultra Platinum
Lol okay I’ll avoid getting my ass kicked then. So my pseudocode is bulky and too much. If I was to simplify it I could just say what the step is and not show every variable like I did?
It really depends on how much detail they want. Mine was minimal. You'll have to feel it out.

Remember pseudo code is in-between your normal human language and code. Use standard statements like if, else, then, for etc. But you can write it so a human can read it. Generally, write pseduocode like real code - one statement at a time.

Pseudo code is not specifications so you don't need to define arrays and stuff like that.

The goal of pseduocode is for the engineer to give to the code monkey so they can write it in the language that best suits the project.

Point number 2: pseduocode should be programming language agnostic.

For your specific case, I would think your pseduo code could be less than 20 words, total, all statements combined.
 
Last edited:

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
It really depends on how much detail they want. Mine was minimal. You'll have to feel it out.

Remember pseudo code is in-between your normal human language and code. Use standard statements like if, else, then, for etc. But you can write it so a human can read it. Generally, write pseduocode like real code - one statement at a time.

Pseudo code is not specifications so you don't need to define arrays and stuff like that.

The goal of pseduocode is for the engineer to give to the code monkey so they can write it in the language that best suits the project.

Point number 2: pseduocode should be programming language agnostic.

For your specific case, I would think your pseduo code could be less than 20 words, total, all statements combined.
I tried to clear it up more, here is an update (after about 15 others) I hope this makes better sense.
 

Attachments

  • image.jpg
    image.jpg
    1.9 MB · Views: 218

Space Lynx

Astronaut
Joined
Oct 17, 2014
Messages
16,000 (4.60/day)
Location
Kepler-186f
Realistically, pseudo code is a human readable example of code. Such as getting out of bed:

Open eyes
Check clock
If weekend:
--> set alcohol to whiskey
Else:
--> set slcohol to tequila
While day sucks:
--> drink alcohol

If you submit code, your instructor is going to kick your ass.

is this what elon musk is referring to as evidence our entire existence could be a coded program?
 
Joined
Mar 10, 2015
Messages
3,984 (1.20/day)
System Name Wut?
Processor 3900X
Motherboard ASRock Taichi X570
Cooling Water
Memory 32GB GSkill CL16 3600mhz
Video Card(s) Vega 56
Storage 2 x AData XPG 8200 Pro 1TB
Display(s) 3440 x 1440
Case Thermaltake Tower 900
Power Supply Seasonic Prime Ultra Platinum

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
It's better but look at how a few languages loop through data.

https://www.w3schools.com/python/python_for_loops.asp



At times, python is practically like writing pseduocode.
Oh I see, geez I need to learn better the meaning for “if, then, while, etc”. My understanding is limited at the moment and not knowing fully how to utilize these is hindering my work. Looks like it’s vocab time. Thank you for all your help! It has really brought me closer to understanding what I am writing. I’ll post another update when I revise my work once more. Your awesome!
 
Joined
Mar 10, 2015
Messages
3,984 (1.20/day)
System Name Wut?
Processor 3900X
Motherboard ASRock Taichi X570
Cooling Water
Memory 32GB GSkill CL16 3600mhz
Video Card(s) Vega 56
Storage 2 x AData XPG 8200 Pro 1TB
Display(s) 3440 x 1440
Case Thermaltake Tower 900
Power Supply Seasonic Prime Ultra Platinum
Oh I see, geez I need to learn better the meaning for “if, then, while, etc”. My understanding is limited at the moment and not knowing fully how to utilize these is hindering my work. Looks like it’s vocab time. Thank you for all your help! It has really brought me closer to understanding what I am writing. I’ll post another update when I revise my work once more. Your awesome!
Any time! The start of CS is the best. Everything still feels magical and impressive.

I'm also doing my best not to just tell you. Harder than it sounds.
 

Tatertsalad69

New Member
Joined
Jul 19, 2021
Messages
9 (0.01/day)
Any time! The start of CS is the best. Everything still feels magical and impressive.

I'm also doing my best not to just tell you. Harder than it sounds.
Lol I appreciate it! I like learning and I enjoy challenges, is why I play my games on hardest modes off rip.
 
Top