Can someone check randomness and how simple the code is? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone check randomness and how simple the code is?

/*At first I have to apologise for my English language, its not my mother tongue and for now I am not as fluent as I want to be. (I'll be writing this on my posts to clarify this fact)*/ After this "small" disclaimer I can move on. So I made this simple code just to show random location on Earth and say on which hemispheres the place is. Here are two questions: 1. Can I write this simpler with smaller amount of variables? 2. Is randomness wrote as it should be (maybe I missed a case that cannot happen in my code)? Thanks in advance! :) https://code.sololearn.com/WfJZT1qloRJB/?ref=app

3rd Jan 2019, 7:57 PM
Unreal Shadow
Unreal Shadow - avatar
3 Answers
+ 2
Hi Unreal Shadow, The code seems to be correctly written👍 Recommended is to use comments for the functionallity codes that you are using for certain tasks. Do not forget to close the end of a line with semicolon. Furthermore the random generation seems also to be correct. Additional you can fuse minute1 & minute2 variables together since they have the same values. Tip:Try not to repeat Have a look at the changes, hope it helps👍😊 https://code.sololearn.com/WKPwKga9Sbab/?ref=app
5th Jan 2019, 12:22 AM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 1
Thank you Vincent for tips and checking my code! Your version is much cleaner and better, I'll try to follow same rules to make my codes better for viewing! One more time: BIG thanks! :)
5th Jan 2019, 5:57 PM
Unreal Shadow
Unreal Shadow - avatar
+ 1
You're welcome👍😊
5th Jan 2019, 6:35 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar