Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,249 members, 7,953,928 topics. Date: Friday, 20 September 2024 at 09:10 AM

Gbolly1151's Posts

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

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

Programming / Re: Tutorial: Object Oriented Programming Paradigm For Beginners in Python by gbolly1151(m): 7:06pm On May 09, 2020
6ixT8:
interesting... gboll1151 where are you
Am here, i should have posted the next topic but all the time have been trying to post it,Nairaland will delete it and ban me for a day.....i don't know what is going wrong.....you can get the next topic here on my facebook page

https://www./2604470076495701/permalink/2611250559150986/?app=fbl
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 6:36am On May 07, 2020
I don't understand why nairaland is deleting my post please help ooo
Programming / Re: Tutorial: Object Oriented Programming Paradigm For Beginners in Python by gbolly1151(m): 6:34am On May 07, 2020
Guys...anytime i tried to post the composition tutorial, i always get kick on,what may cause this?
Health / Re: Mysterious Deaths Hit Hadejia LG In Jigawa, Over 100 Dead by gbolly1151(m): 8:54am On May 05, 2020
I knew it,govt to take my aboki serious, they are careless than baby....last week i predicted 500cases in the north but i fear to say with my new projection it may get worsen after end of two weeks from now,5000cases is understatement buhari to deploy arm force to the north to enforce proper lockdown.
Programming / Re: Tutorial: Object Oriented Programming Paradigm For Beginners in Python by gbolly1151(m): 12:02pm On May 04, 2020
I dont understand why this forum is giving me on and off....thank God am on today
Culture / Re: Ahmad Muhammad Asha Is Dead! Emir Of Kaura Namoda Dies At 71 by gbolly1151(m): 2:20pm On May 03, 2020
J
Programming / Re: Tutorial: Object Oriented Programming Paradigm For Beginners in Python by gbolly1151(m): 7:43pm On May 02, 2020
yemyke001:



Following boss.. This is actually great
Alright sir
Programming / Re: Share Your Road map To Becoming A Web Developer. by gbolly1151(m): 7:41pm On May 02, 2020
voraz:
Just began to learn Python a month ago.
I'm looking to delve into Data Science and then Machine Learning

What would you recommend to keep going?
What should be on my table after Python?

Cc:
Grandlord
Lordpeckxy
Crownedrookie
Solexx
Solve many exercises to test your basics and advanced(oop,decorator,generator etc) knowledge in python before you start learning Machine learning,it will really ease your learning of ML and Data science
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 7:31pm On May 02, 2020
HOW TO USE GLOBALS() AND LOCALS() FUNCTION
In programming we have two types of variable namely:
1. Global variable
2. Local variable

Before we dive into those two varibles,you need to understand
that all your variable name and value in python are stored
in a dict data structure e.g


value=1
Good=True

the way python present this is,

{'value':1,'Good':True}


#Then how can we checked this structure? just use
print(globals())

output will be

{'__builtins__': <module 'builtins' (built-in)>,
'__file__': '/storage/sdcard0/qpython/scripts3/.last_tmp.py',
'value': 1,'Good':True '__package__': None,
'__cached__': None, '__name__': '__main__', '__doc__': None}

you can see that your variables are stored in dict structure
'value':1 and 'Good':True

To get value use

print(globals()['value'])
output
1

for now dont mind other variables you saw in the global scope,they are needed for your program to work well

All variable that can be obtained through globals() are called global variable.These are variables that are in
__main__ i.e global enviroment of the program

Now let talk about local variable....

All variable you create after indentation,they are all
local variable example of structure that use indentation are
function,class,with ,if else et.c . Let check this;


def increment():
fund=36
return True


variable name 'fund' is written after an indentation,which is
local variable of increment function,this means only increment
has the power to perform operation on fund . To check and
print the local variable just use keyword locals() and
all local variable will be displayed


def increment():
fund=36
return locals()

print(increment())

output

{'fund': 36}


Let take a break from here and continue with global and nonlocal keyword later
Programming / Re: Tutorial: Object Oriented Programming Paradigm For Beginners in Python by gbolly1151(m): 7:21pm On May 02, 2020
kunlegboye:
Boss we appreciate your efforts a lot,really educative opened my understanding on the concept of oop. ...We are waiting for the remaining ones...and God will bless you mightily for this
Amen sir....I will try my best sir to keep updating the thread
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 2:43pm On May 02, 2020
A SIMPLE DIFFERENCE BETWEEN repr() and str()


string='hello\nword' #note the special character \n

print('str format is')
print(str(string))
print('repr format is')
print(repr(string))

output:

str format is
>>hello
>>word

repr format is
>>'hello\nword'
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 2:36pm On May 02, 2020
gbolly1151:
You can join my Facebook page @

https://m./2604470076495701

I dont really understand why Nairaland is keeping me on and off these days, while am still here you can join me my Facebook page...
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 10:37pm On Apr 30, 2020
kensmoney:

ken="kensmoney is good boy"

def count_char(a,b):
char = b.lower()
stri = a.lower()
counter=0
for a in stri:
if a == char:
counter += 1

print(counter)



count_char(ken, "o" )
#4

Check your code bro,it doesn't seem right
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 12:06pm On Apr 30, 2020
HOW TO CHECK FOR EVEN AND ODD NUM IN 2 LINES OF CODE

num=int(input('your num '))
print('even' if (bin(num)).endswith('0') else 'odd')
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 11:36am On Apr 30, 2020
jayphe:

Exercise 6
Write a Python program that accepts an integer number and checks if it is an even number or an odd number. Pls don't use the % (modulus) operator. Let's see some genuius.

Let me see if my ojoro will work here....


num=int(input('your num '))
status='even' if (bin(num)).endswith('0') else 'odd'
print(status)


Oya find me the bug
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 8:13am On Apr 30, 2020
Daddyshome:

Note: I am a beginner, so don't expect clean code. Also, I suck at naming variables grin . It can definitely be improved upon. I can protect the code with trys here and there, to prevent certain errors. I don't know if the list is necessary, but I don't know any way to sort dictionaries by time or maybe I should have stored the contacts using another data type. Criticism is welcome smiley


contacts = dict()
contacts_date = list()


def save_contact(name, number):
contacts[name] = number
contacts_date.append([name, number])
print('contact saved')

def display_contact_alphabetical():
print('Name\tNumbers')
for i, j in sorted(contacts.items()):
print( '{}\t{}'.format(i, j))


def delete(name):
contacts_date.remove([name, contacts[name]])
del contacts[name]
print('contact deleted')

def display_contact_date():
for a, b in contacts_date:
print('{}\t{}'.format(a, b))


def edit_contact_name(old_name, new_name):
tmp = contacts[new_name]
delete(old_name)
save_contact(new_name, tmp)
print('Contact information updated')


def edit_contact_num(name, new_num):
delete(name)
save_contact(name, new_num)
print('Contact information updated')


while True:
print('Press \n1. To save a contact\n2. To display contats\n3. To delete a contact\n4. To edit a contact\n5. To quit')
user_input = int(input())
if user_input == 1:
response_to_one = input('Enter name and number')
cont_name, cont_num = response_to_one.split()
save_contact(cont_name, cont_num)
elif user_input == 2:
print('Press \n1. To display alphabetically\n2. To display by time')
reply = int(input())
if reply == 1:
display_contact_alphabetical()
elif reply == 2:
display_contact_date()
elif user_input == 3:
response_to_three = input('Enter name')
delete(response_to_three)
elif user_input == 4:
print('Press \n1. To edit contact name\n2. To edit contact number')
reply_two = int(input())
if reply_two == 1:
reply_two_one = input('Enter old name and new name')
old_name, new_name = reply_two_one.split()
edit_contact_name(old_name, new_name)
elif reply_two == 2:
reply_two_two = input('Enter name and number')
cont_name, cont_num = reply_two_two.split()
edit_contact_num(cont_name, cont_num)
elif user_input == 5:
print('Exiting')
break


Nice one...by the time you learn class...you will really appreciate what you have done here,this is good for a start
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 7:57am On Apr 30, 2020
Guy when you are posting code,you can use this format

[Code]
#Your code here

[/Code]

Change the C to c

Example of output is


print('hello word')

1 Like

Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 7:46am On Apr 30, 2020
[quote author=StevDesmond post=89009836][/quote]

This seem to be the perfect algorithm to solve it.nice one sir
Programming / Re: Why Is Python Programming So Hard To Understand by gbolly1151(m): 9:22pm On Apr 29, 2020
scarplanet:


Anyways, not many persons will agree with you that Pycharm is the best. Do you realise that Pycharm is not entirely free??

Just use the IDE you feel most comfortable with and that works well for you. Other IDEs include Jupyter, Eclipse, Visual Studio, Spyder, Sublime Text e.t.c

Ok thanks...i think i will go with you by using IDE that is comfortable
Programming / Re: Why Is Python Programming So Hard To Understand by gbolly1151(m): 10:17am On Apr 29, 2020
ATTITUDE2:
Good day everyone. I want to start coding. I've downloaded the python app. please recommend a IDE for me.

cc. gbolly1151 Daejoyoung yuno01 locusy

Soory for late reply,just got my acct back....pycharm is the best,but i do use pyscripter

1 Like

Programming / Re: At 40, Can I Still Learn Programming And Be Good At It? by gbolly1151(m): 8:40am On Apr 26, 2020
romeo411:
I honestly want to switch to programming as in carrier change, considering that I am 40, can I still make it giving every input I put in.

Age is not a barrier and anything is possible

7 Likes

Programming / Re: Let's Learn Python Together by gbolly1151(m): 8:35am On Apr 26, 2020
07060435624 abeg add me
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 10:46pm On Apr 25, 2020
Zabiboy:
[b] [i][font=serif] Ok guys....concerning my last post on real life applications of python, here are some projects you can try...


2) SITE CONNECTIVITY CHECKER:
When you visit a URL, you expect to get the requested pages on your browser. But this is not always the case. Sometimes, sites can be down, so you won’t get the desired results. Instead, you’ll be presented with error messages. You can keep trying a site that is down, till it comes up and you get the information you need.

This is where the Site Connectivity Checker project comes in. The Site Connectivity Checker visits a URL and returns the status of the URL: it is either live or not. 

The main objective of this project is to check the status of sites. So, you need to write code for checking the status of a website.....

Those who learnt socket programming in python would find this easier..




Import requests

def con_checker(url):
response=requests.get(url)
if response.status_code == 200:
return 'connected'
else: return 'unexpected error'
Programming / Re: Python 3: Exercises And Solutions. by gbolly1151(m): 9:29pm On Apr 25, 2020
Nice one,let me get my hand dirty here
Programming / Re: Common good python programming practices you should know by gbolly1151(m): 9:22pm On Apr 25, 2020
scarplanet:
Well done chief
Thanks sir

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (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. 36
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.