Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,392 members, 7,819,403 topics. Date: Monday, 06 May 2024 at 03:44 PM

Gbolly1151's Posts

Nairaland Forum / Gbolly1151's Profile / Gbolly1151's Posts

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 16 pages)

Programming / Re: Common good python programming practices you should know by gbolly1151(m): 7:39pm On Oct 14, 2020
It been a while here
Politics / Re: Blackout Imminent As Kainji Dam Bursts, Nigeria To Lose 760MW by gbolly1151(m): 10:11pm On Sep 14, 2020
Ok
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 4:20am On Aug 12, 2020
Predstan:

Yeah, where have you been? I don day use tensorflow
Wao!!!...that is cool bro,keep moving
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 7:25am On Aug 11, 2020
Quite an age here
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 1:49pm On Jul 19, 2020

#EXAMPLE OF MISTAKE YOU MUST AVOID AS A BEGINNER USING PYTHON

print('example 1',1 is (not None)) # return False
print('example 2',1 is not None) # return True

'''
Before i explain why both statement return different value,Remenber that
'is' keyword in python is used to check if two objects have
the same id() and Note that, it is different from ==
which check if two objects have the same value

now let break down example 1;
1 is (not None)
(not None) in python will return True and
1 is True will return false because
1 and True represent different objects store with different id()
'''
print(not None) #return True

'''
Now example 2, 1 is not None
this check if id(1) is not id(None) and the answer
is True
'''
print(id(1),id(None))
Politics / Re: Rape: Osun Begins Martial Arts Training For women by gbolly1151(m): 8:04am On Jul 19, 2020
This man don watch Chinese film tired, he thought the way dey do for film na so e be for real life

1 Like

Programming / Re: Data Structure And Algorithms Programmers Needed For A High Paying Gig by gbolly1151(m): 11:53pm On Jul 18, 2020
For Python contact me on 07060435624

1 Like

Business / Why My Post Always Get Deleted On This Section? by gbolly1151(m): 12:36pm On Jul 15, 2020
Hello,please @mod should tell me why my post got deleted whenever i post here about our exchange site,thank
Programming / Re: Where Can I Learn Programming In Illorin? by gbolly1151(m): 9:20pm On Jul 14, 2020
ibromodzi:


Boss so you stay in Ilorin...that's really nice. I'll like to connect with you via whatsapp.
No problem boss
Programming / Re: Where Can I Learn Programming In Illorin? by gbolly1151(m): 11:57am On Jul 14, 2020
Esmael23:
Gosh! Why am I just seeing this thread 4years later? Can anyone teach me please. I am in ilorin 08062615965
I stay in ilorin and want to off load most stuff i have learned in python so far to people...if you are interested pm on 07060435624

Paid service but friendly

You can also check my thread on "common python programing practice"
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 12:24pm On Jul 13, 2020
NettyNelly:


What modules do I need to import to solve this.?
I used queue and random modules, but seems something is missing.
Bro, do share the solution with us. Seems none of us has a a good solution.

Here is what i solve long time ago and works


class share:
def __init__(self,unit,price):
self.unit=unit
self.price=price

class stock:
def __init__(self):
self.shares=[]
self.CGL=0
self.total_units=0

def buy(self,unit,price):
self.total_units += unit
self.shares.insert(0,share(unit,price))

def sell(self,unit,price):
assert unit < self.total_units, "units can't exceed total units"
while unit > 0:
share=self.shares.pop()
curr_share=0
if unit > share.unit:
curr_share=share.unit
unit -= share.unit
else:
curr_share=unit
share.unit -= curr_share
self.shares.append(share)
unit = 0
self.CGL += (curr_share * (price - share.price))
self.total_units -= curr_share



S1=stock()
buy=[(100,20),(20,24),(200,36)]
for unit,price in buy:
S1.buy(unit,price)
S1.sell(150,30)
print('capital gain is',S1.CGL,'\ntotal unit left',S1.total_units)



Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 11:13pm On Jul 12, 2020
NettyNelly:


What modules do I need to import to solve this.?
I used queue and random modules, but seems something is missing.
Bro, do share the solution with us. Seems none of us has a a good solution.
Queue is FIFO so you can use it,but the real data structure to use in real world should be Priority Queue
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 11:10pm On Jul 12, 2020
NettyNelly:


What modules do I need to import to solve this.?
I used queue and random modules, but seems something is missing.
Bro, do share the solution with us. Seems none of us has a a good solution.

I will try and solve it and release the answer tomorrow
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 2:37pm On Jul 12, 2020
CHECK OUT THIS PYTHON FLOW


l=[2]
l.append(l.append(1))
print(l)
#TRY GUESSING.....
#output: [2,1,None]

'''
WHY None?
reason behind this output is that
append() is a method that only add value at the
end of the list,so it does not have return value.
By default,None is returned if you dont specify
return value in a function

e.g
'''
def fun():
v=5

print(fun()) #output: None

'''
so we can break it like this
'''
l=[2]
v=l.append(1) # v = None
l.append(v)
print(l) #output: [2,1,None]
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 11:37am On Jul 11, 2020
KEY DIFFERENT BETWEEN return AND yield IN PYTHON

Return - this keyword terminate a function
Yield - pause the execution of a function
Programming / Re: LEARN ETHICAL HACKING,TIPS AND TRICKS by gbolly1151(m): 6:05pm On Jul 08, 2020
Should:
see my boss oo!
I was carefully reading until I saw this your mention now....

My moniker made me not to reply mentions, they're too much!!!
Thanks a lot bro.. .
This is huge

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (of 16 pages)

(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. 28
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.