Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,298 members, 7,808,012 topics. Date: Thursday, 25 April 2024 at 03:22 AM

The Myth Of Saturation With Regards To Web Development. - Programming (10) - Nairaland

Nairaland Forum / Science/Technology / Programming / The Myth Of Saturation With Regards To Web Development. (17033 Views)

Introduction To Web 3.0 / How to add images to web pages with coding / How to code buttons to web pages (2) (3) (4)

(1) (2) (3) ... (7) (8) (9) (10) (Reply) (Go Down)

Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 2:41pm On Nov 20, 2021
Gbsks:
Hmm, well I think the built in max method can be called upon a list containing the inputs. Caveat: The max function is O(n).

I know. But I was talking about the code itself. There are some bits of the code that dlas it is that don't need to be there?
Re: The Myth Of Saturation With Regards To Web Development. by Gbsks: 3:03pm On Nov 20, 2021
airsaylongcome:


I know. But I was talking about the code itself. There are some bits of the code that dlas it is that don't need to be there?
Oh, I've seen it. The parentheses around the comparison of values was unnecessary, assigning the value to another variable "Largest" was unnecessary, the = operator was also unnecessary, the code get kleg sef, he should have considered the probability that the values could be equal since he decided to use the = operator along with the > operator.
Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 6:55pm On Nov 20, 2021
Gbsks:
Oh, I've seen it. The parentheses around the comparison of values was unnecessary, assigning the value to another variable "Largest" was unnecessary, the = operator was also unnecessary, the code get kleg sef, he should have considered the probability that the values could be equal since he decided to use the = operator along with the > operator.

Good points. I'm also thinking was there any need to do the elif num2>=num1?
Re: The Myth Of Saturation With Regards To Web Development. by Gbsks: 8:27pm On Nov 20, 2021
airsaylongcome:


Good points. I'm also thinking was there any need to do the elif num2>=num1?
I don't think so too. There are many flaws in the code.
Re: The Myth Of Saturation With Regards To Web Development. by islamics(m): 10:12pm On Nov 21, 2021
airsaylongcome:
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
if (num1 >= num2) and (num1 >= num3):
.....largest = num1
elif (num2 >= num1) and (num2 >= num3):
..... largest = num2
else:
.....largest = num3
print("The largest number is", largest)

Saw this code somewhere on Nairaland and while it's mostly correct, I think it is suboptimal. To spark a conversation, how would you guys go about optimising it?

How about after getting the three numbers, then we say:
int largest = number1
If number2 > largest
largest = number2
If number3 > largest
largest = number3

In this case, I think the number of comparison is reduced.

airsaylongcome:


Good points. I'm also thinking was there any need to do the elif num2>=num1?

Based on the person code logic, I think it was needed.
Re: The Myth Of Saturation With Regards To Web Development. by GeneralDae: 10:23pm On Nov 21, 2021
airsaylongcome:


Good points. I'm also thinking was there any need to do the elif num2>=num1?
I don't see anything wrong with the code though. It looks perfect and Pythonic enough ( the one way of doing it) to me. I may be wrong though.
Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 10:30pm On Nov 21, 2021
islamics:


How about after getting the three numbers, then we say:
int largest = number1
If number2 > largest
largest = number2
If number3 > largest
largest = number3

In this case, I think the number of comparison is reduced.



Based on the person code logic, I think it was needed.

So yes I think the number of comparisons should reduce. After the initial check of num1>=num2 I don't think there should have been a check for that again in the elif. I'm rusty in my programming so I don't have a ready solution for that. But I believe after the first check there was no need to check it again because we would already know if num1 was greater or not after that check
Re: The Myth Of Saturation With Regards To Web Development. by islamics(m): 9:49am On Nov 22, 2021
airsaylongcome:


So yes I think the number of comparisons should reduce. After the initial check of num1>=num2 I don't think there should have been a check for that again in the elif. I'm rusty in my programming so I don't have a ready solution for that. But I believe after the first check there was no need to check it again because we would already know if num1 was greater or not after that check
After checking num1>=num2, there is a need to compare using num2 in case num2 will be the largest in the elif. The approach is the basic logic.
If you consider the first number as largest and then compare with others, your number of comparison will always be n-1 which is small improvement grin
But I believe after the first check there was no need to check it again because we would already know if num1 was greater or not after that check
We would know but we wouldn't know for certain if num2 or num3 is greater.
You can open your terminal, run different variation of the code and see the results.
Re: The Myth Of Saturation With Regards To Web Development. by GeneralDae: 11:17am On Nov 22, 2021
airsaylongcome:


So yes I think the number of comparisons should reduce. After the initial check of num1>=num2 I don't think there should have been a check for that again in the elif. I'm rusty in my programming so I don't have a ready solution for that. But I believe after the first check there was no need to check it again because we would already know if num1 was greater or not after that check
There's a need to also check if num 2>=num1, because that's a possibility. num 1 could be >= num 2, but it could also happen that num 2 is rather >= num 1. You definitely have to account for all possibilities.
Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 1:55pm On Nov 22, 2021
GeneralDae:

There's a need to also check if num 2>=num1, because that's a possibility. num 1 could be >= num 2, but it could also happen that num 2 is rather >= num 1. You definitely have to account for all possibilities.

So let's look at it

If (num1>=num2)...

If the condition evaluates to true do we need to check num2>=num1? If it evaluates to false do we need to check num2>=num1?
Re: The Myth Of Saturation With Regards To Web Development. by GeneralDae: 5:56pm On Nov 22, 2021
airsaylongcome:


So let's look at it

If (num1>=num2)...

If the condition evaluates to true do we need to check num2>=num1? If it evaluates to false do we need to check num2>=num1?
I get your point now. However, the way the code was written by giving condition to num 1 with respect to num 2 and num 3, if we fail to also give similar conditions to num 2 and num 3 ( being explicit enough), we may not get the desired outcome.
Thinking about it now, I think a better way would be to make a list of num1, num 2, and num 3, and then find the maximum. I'll try that to see if that is possible.
Re: The Myth Of Saturation With Regards To Web Development. by GeneralDae: 6:21pm On Nov 22, 2021
airsaylongcome:


So let's look at it

If (num1>=num2)...

If the condition evaluates to true do we need to check num2>=num1? If it evaluates to false do we need to check num2>=num1?
This should be the optimal code:

num1=float (input ('Enter first number:')
num2=float (input ('Enter second number:')
num3=float (input('Enter third number:')

a=[num1, num2, num3]
print (max(a))

Answer
Enter first number: 4
Enter second number: 5
Enter third number: 2
5.0
Re: The Myth Of Saturation With Regards To Web Development. by islamics(m): 6:51am On Nov 23, 2021
airsaylongcome:


So let's look at it

If (num1>=num2)...

If the condition evaluates to true do we need to check num2>=num1? If it evaluates to false do we need to check num2>=num1?
Nope. I think I get your logic now.
Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 3:07pm On Nov 23, 2021
islamics:

Nope. I think I get your logic now.

I'm from the If..then...else languages. So in rough pseudocode

If (num1>=2) then
{
If (num1>=num3) then max==num1
} else if (num2>=num3) then max==num2
else max==num3

This may not be optimal for edge cases where all three inputs are equal
Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 3:09pm On Nov 23, 2021
GeneralDae:

This should be the optimal code:

num1=float (input ('Enter first number:')
num2=float (input ('Enter second number:')
num3=float (input('Enter third number:')

a=[num1, num2, num3]
print (max(a))

Answer
Enter first number: 4
Enter second number: 5
Enter third number: 2
5.0


This is also correct. But I wasn't talking about using arrays and inbuilt max function. Just pure conditionals. Nice solution all the same

1 Like

Re: The Myth Of Saturation With Regards To Web Development. by shezpwiti(f): 7:41pm On Nov 23, 2021
Please is 31 years old too late to learn how to be a web developer?
Re: The Myth Of Saturation With Regards To Web Development. by GeneralDae: 10:19pm On Nov 23, 2021
shezpwiti:
Please is 31 years old too late to learn how to be a web developer?
I don't know where people get the notion that old people don't code or one can be too old to code. Is this perception from Hollywood that shows us young nerds and geeks hacking away at a very young age?

If you want to start something, start. You don't need our validation to make you decide if you're too old or not. So if we say yes you are too old to code, what then? Does it mean you'll then abandon your desire to learn web development? If you do that, one can assume you were only looking for an excuse not to begin your web development journey in the first place.

2 Likes

Re: The Myth Of Saturation With Regards To Web Development. by Pa5sa38: 10:14pm On Nov 24, 2021
Please I have basic knowledge of html and css what should I learn to become a web developer
Re: The Myth Of Saturation With Regards To Web Development. by airsaylongcome: 4:21pm On Nov 26, 2021
shezpwiti:
Please is 31 years old too late to learn how to be a web developer?

Absolutely NOT! If you gender here on NL (female) then I would advise that you look into UI/UX design or Product Dev. I find that (and this is my personal opinion) Women have a brain that can handle aesthetics very well
Re: The Myth Of Saturation With Regards To Web Development. by shezpwiti(f): 4:25pm On Nov 26, 2021
I'm actually female. Thanks for the recommendation
airsaylongcome:


Absolutely NOT! If you gender here on NL (female) then I would advise that you look into UI/UX design or Product Dev. I find that (and this is my personal opinion) Women have a brain that can handle aesthetics very well
Re: The Myth Of Saturation With Regards To Web Development. by oluwaniyi66(m): 5:30pm On Feb 28, 2022
tensazangetsu20:

It seems you are a pythonista. Anyway it's just my experience. Everyone will eventually make their own choice las las na.

Good day sir, please I want to talk to you

tensazangetsu20
Re: The Myth Of Saturation With Regards To Web Development. by specialofficer: 3:54am On Mar 03, 2022
tensazangetsu20:

The 650 was worldwide o. What I used to do then was go country by country search the number of shipping companies and send unsolicited applications it was useless. As for Nigeria, I had a very nice shoe I bought when i graduated. I used to wear it with corporate shirts and trousers to job hunt in Apapa. That shoe spoilt because of job hunting. I dont think theres any shipping company in Nigeria that doesnt have a copy of my CV on file. As for wordpress, I do the deep stuff. Custom themes and plugins. I know PHP. I recently just built a website a wordpress website complete with custom themes and plugins for a conglomerate in the USA. The company does over 10 billion USD in revenue yearly and employs over 30000 people. I cant mention the name here or someone on my team can link it back to me.

Honestly tech to me is the only place I can advise Nigerians to go into and the best place to start especially if you are underprivileged is in the university. If you have no laptop, a lot of your colleagues will have and you can borrow or you can utilise any computer at your school labs which are mostly empty anyway. I wish I knew about this industry in the university. My free time at school was used in watching movies and playing video games. So annoying.
Good day sir, I'm a commercial student that just got admission into the university, I was in 300l in uni but left uni 3 years ago to go do something that would help myself but it backfired, now I'm starting afresh...




I'll be 24 this year, I'm good in maths, my sister was telling me to go into tech, I don't know if it's possible for someone studying economics to go into tech, mind you I just gained admission, I've not even resumed, what advice will you give me sir?


Is it advisable to go into tech? You know as a student you'll need small small money to take care of your needs and age is no longer on my side embarassed

1 Like

Re: The Myth Of Saturation With Regards To Web Development. by Kenny242(m): 2:19pm On Mar 03, 2022
tensazangetsu20:

My own friend started learning data science in 2019. That was a year before I learnt coding. I have switched like 3 jobs now and he's yet to get the first data science one. I have told him to abandon that crap he said AI is the future. Future my ass. Person no go chop for present.
It’s not crap though sad
Re: The Myth Of Saturation With Regards To Web Development. by BeLookingIDIOT(m): 9:08pm On May 01, 2023
tensazangetsu20:

My own friend started learning data science in 2019. That was a year before I learnt coding. I have switched like 3 jobs now and he's yet to get the first data science one. I have told him to abandon that crap he said AI is the future. Future my ass. Person no go chop for present.
Abeg how far your friend grin ? Did he later get the data science job? I'm yet undecided wether to learn web development or data science.
Re: The Myth Of Saturation With Regards To Web Development. by tensazangetsu20(m): 9:31pm On May 01, 2023
BeLookingIDIOT:

Abeg how far your friend grin ? Did he later get the data science job? I'm yet undecided wether to learn web development or data science.

Na he never did. Went into cyber security
Re: The Myth Of Saturation With Regards To Web Development. by BeLookingIDIOT(m): 9:34pm On May 01, 2023
tensazangetsu20:


Na he never did. Went into cyber security
Wow.
Isn't the job prospect for cyber security even worse than data science
Re: The Myth Of Saturation With Regards To Web Development. by tensazangetsu20(m): 9:35pm On May 01, 2023
BeLookingIDIOT:

Wow.
Isn't the job prospect for cyber security even worse than data science

He was lucky to get a good cyber security job with a Nigerian bank. They are training him and paying for every certification exam.
Re: The Myth Of Saturation With Regards To Web Development. by Nobody: 6:50am On May 02, 2023
BeLookingIDIOT:

Abeg how far your friend grin ? Did he later get the data science job? I'm yet undecided wether to learn web development or data science.

data science for sure.
Re: The Myth Of Saturation With Regards To Web Development. by BeLookingIDIOT(m): 6:09pm On May 04, 2023
Failure2019:


data science for sure.
I personally prefer data science,but I'm hearing no jobs just like his friend.
Re: The Myth Of Saturation With Regards To Web Development. by KillingJoke: 5:00pm On Dec 30, 2023
Jeez


Too many man children on this thread

(1) (2) (3) ... (7) (8) (9) (10) (Reply)

Should We Make Mobile Apps Or Web Apps For The Nigerian/African Market? / Can I Code With My Phone / Will You Choose Your Girlfriend Over Your Computer?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 56
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.