• 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.14/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: 59

Solaris17

Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
22,453 (3.82/day)
Location
Florida
System Name Venslar
Processor I9 7980XE
Motherboard MSI x299 Tomahawk Arctic
Cooling EK Custom
Memory 32GB Corsair DDR4 3000mhz
Video Card(s) Nvidia Titan RTX
Storage 1x 250GB 960 EVO | 1x 500gb Intel 720p | 32TB SAN
Display(s) 3x AOC Q2577PWQ (2k IPS)
Case Inwin 303 White (Thermaltake Ring 120mm Purple accent)
Audio Device(s) Schiit Fulla 3 on Beyerdynamic DT 990 Pros
Power Supply Seasonic 1050W Snow
Mouse M55 RGB PRO (White)
Keyboard Ducky Shine 6 Snow White
VR HMD HTC VIVE
Software Windows 10 x64 Pro
Ask your teacher for clarification?
 
Joined
Jul 9, 2016
Messages
739 (0.39/day)
System Name Main System
Processor i9-10940x
Motherboard MSI X299 Xpower Gaming AC
Cooling Noctua NH-D15S + Second Fan
Memory G.Skill 64GB @3600MHz XMP
Video Card(s) ASUS ROG Strix RTX 3090
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 EVGA Z20 Clicky
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.14/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
4,720 (0.98/day)
System Name A happy middle ground
Processor [Ryzen 5 3600X]
Motherboard [ASRock X570 Phantom Gaming 4S]
Memory [64GB G.Skill Ripjaws (16GBx4)]
Video Card(s) [EVGA RTX 3060 Ti XC]
Storage [500GB Crucial P2 M.2 , 2TB Samsung 860 QVO SSD]
Display(s) [27" ASUS at 1920x1080p - 34" Samsung at 1440p]
Case [Fractal Meshify-C]
Power Supply [CORSAIR RM 650]
Mouse [Logitech G Pro]
Keyboard [Logitech G810]
Software [Windows 10 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.14/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
4,720 (0.98/day)
System Name A happy middle ground
Processor [Ryzen 5 3600X]
Motherboard [ASRock X570 Phantom Gaming 4S]
Memory [64GB G.Skill Ripjaws (16GBx4)]
Video Card(s) [EVGA RTX 3060 Ti XC]
Storage [500GB Crucial P2 M.2 , 2TB Samsung 860 QVO SSD]
Display(s) [27" ASUS at 1920x1080p - 34" Samsung at 1440p]
Case [Fractal Meshify-C]
Power Supply [CORSAIR RM 650]
Mouse [Logitech G Pro]
Keyboard [Logitech G810]
Software [Windows 10 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.14/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.67/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.14/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.67/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.14/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: 14
Joined
Oct 17, 2014
Messages
8,223 (3.25/day)
Location
USA
System Name Paladin Endwalker
Processor Ryzen 6800X 8-Core
Motherboard AM5 x670
Cooling Vetroo V5 (White with two fans in push/pull)
Memory DDR5 --- 2x16gb (32gb)
Video Card(s) RX 7800 XT
Storage Samsung 1080 Pro Gen5 NVME 1TB
Display(s) LG 42" 120hz 4K OLED
Case Montech Air X (White)
Audio Device(s) SennHD58X, Schiit Asgard 2 AMP, Modi 3 DAC
Power Supply EVGA 700w Gold
Mouse Razer Naga X (2021 Edition)
Keyboard Logitech Cherry Mx Red
VR HMD Valve Index 2 (TBD)
Software WIndows 11 and Linux Mint (Dual Boot)
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.67/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.14/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.67/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.14/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