Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,892 members, 7,802,875 topics. Date: Saturday, 20 April 2024 at 12:33 AM

Python Programming - Programming (12) - Nairaland

Nairaland Forum / Science/Technology / Programming / Python Programming (61614 Views)

Anyone That Know Python Programming Should Help Me To Check The Eorr This / Support Python Programming With Android Devices :qpython E.t.c / What Can Python Programming Language Build? (2) (3) (4)

(1) (2) (3) ... (9) (10) (11) (12) (13) (14) (Reply) (Go Down)

Re: Python Programming by ypeace: 11:29pm On Apr 30, 2018
efficiencie:
BEGINNER CHALLENGE (copied)

Sliding window array multiplication.

Find my solution in the link below (together with one liner)........ Remove the space before .com


https://pastebin .com/416XdY7n

Re: Python Programming by efficiencie(m): 2:33am On May 02, 2018
ypeace:


Find my solution in the link below (together with one liner)........ Remove the space before .com


https://pastebin .com/416XdY7n

shocked This one-liner is critical! Make I look am well! Anyways here is my one-liner. https://pastebin.com/L18nXV4f

# modified: @ypeace, could you please explain how map works in your one-liner!

Re: Python Programming by ypeace: 11:43am On May 02, 2018
efficiencie:


shocked This one-liner is critical! Make I look am well! Anyways here is my one-liner. https://pastebin.com/L18nXV4f

# modified: @ypeace, could you please explain how map works in your one-liner!

Lolz, your one liner looks better. I think it will be faster too. Map takes in a function as its first arg and an iterable (list, set) as second arg. It then passes each element in the iterable to the function.

def add_five(X):
return x + 5

[map(add_five, [1,2,3,4,5])] //[6, 7, 8, 9, 10]
Re: Python Programming by ypeace: 11:48am On May 02, 2018
ypeace:


Lolz, your one liner looks better. I think it will be faster too. Map takes in a function as its first arg and an iterable (list, set) as second arg. It then passes each element in the iterable to the function.

def add_five(X):
....return x + 5

[map(add_five, [1,2,3,4,5])] //[6, 7, 8, 9, 10]
Re: Python Programming by hilaryxoxo(f): 5:59pm On May 02, 2018
.
Re: Python Programming by efficiencie(m): 9:49pm On May 02, 2018
ypeace:


Lolz, your one liner looks better. I think it will be faster too. Map takes in a function as its first arg and an iterable (list, set) as second arg. It then passes each element in the iterable to the function.

def add_five(X):
return x + 5

[map(add_five, [1,2,3,4,5])] //[6, 7, 8, 9, 10]

Wow! Nice. Thanks for explaining!
Re: Python Programming by efficiencie(m): 2:00am On May 07, 2018
I was playing around with some stuff on decision trees and came up with the following problem. I was able to work out a solution but I think my solution may be too slow and I am hoping someone might have a faster alternative. Here is the problem:

Design a function that accepts a digit; say 'n', and returns a list of lists of unary digits between 0 and 'n-1', pairs of digits between 0 and 'n-1', triples of digits between 0 and 'n-1', up until the '(n-1)-tuple' digits between 0 and 'n-1'.

for example;

if n = 2 the function return: [[0], [1], [0, 1]]
if n = 3 the function returns: [[0], [1], [2], [0, 1], [0, 2], [1, 2], [0, 1, 2]]
if n = 4 the function returns: [[0], [1], [2], [3], [0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]]

cc ypeace, 4kings, Ajibel, adejumoadeoluwa, melodyogonna, alexis, Nobody and co
Re: Python Programming by ypeace: 8:28am On May 07, 2018
hilaryxoxo:
HEY GUYS,

what do you guys think about this online python course?
gurus in the house? Please advise on this.

This is the absolute beginner course https://www.edx.org/course/introduction-to-python-absolute-beginner
This are all the other python courses they have https://www.edx.org/course?search_query=python

Hello. I am not a guru but I think those who have taken those courses can best advice you on it. If you are a complete beginner, I will advice you to start from sololearn (a mobile app). It is good enough for basics. It is also free and easy to get started with (you don't even need to have python on your pc to get started)
Re: Python Programming by hilaryxoxo(f): 9:47am On May 07, 2018
Thank you so much!

ypeace:


Hello. I am not a guru but I think those who have taken those courses can best advice you on it. If you are a complete beginner, I will advice you to start from sololearn (a mobile app). It is good enough for basics. It is also free and easy to get started with (you don't even need to have python on your pc to get started)
Re: Python Programming by ypeace: 10:57am On May 07, 2018
hilaryxoxo:
Thank you so much!

Welcome
Re: Python Programming by Seun(m): 11:05am On May 07, 2018
Lovely thread.

4 Likes 5 Shares

Re: Python Programming by ypeace: 4:34pm On May 07, 2018
efficiencie:
I was playing around with some stuff on decision trees and came up with the following problem. I was able to work out a solution but I think my solution may be too slow and I am hoping someone might have a faster alternative. Here is the problem:

Design a function that accepts a digit; say 'n', and returns a list of lists of unary digits between 0 and 'n-1', pairs of digits between 0 and 'n-1', triples of digits between 0 and 'n-1', up until the '(n-1)-tuple' digits between 0 and 'n-1'.

for example;

if n = 2 the function return: [[0], [1], [0, 1]]
if n = 3 the function returns: [[0], [1], [2], [0, 1], [0, 2], [1, 2], [0, 1, 2]]
if n = 4 the function returns: [[0], [1], [2], [3], [0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]]

cc ypeace, 4kings, Ajibel, adejumoadeoluwa, melodyogonna, alexis, Nobody and co

find my solution in the pix below or here ==>https://pastebin.com/C1ZFfDKa

Re: Python Programming by promisedeco(m): 6:15pm On May 07, 2018
any good python programmer who is based in Awka?
Re: Python Programming by olagunjumariah: 7:34pm On May 07, 2018
Hey guys, I will like to extract daily match odds into an excel template so as to do some calculations. I know it's possible but my zero programming skills is trying to limit me. I'll appreciate it if anyone can be of help.
Re: Python Programming by olagunjumariah: 7:38pm On May 07, 2018
promisedeco:
any good python programmer who is based in Awka?
Hey guys, I will like to extract daily match odds into an excel template so as to do some calculations. I know it's possible but my zero programming skills is trying to limit me. I'll appreciate it if anyone can be of help
Re: Python Programming by efficiencie(m): 10:19pm On May 07, 2018
ypeace:


find my solution in the pix below or here ==>https://pastebin.com/C1ZFfDKa

Here is my annoyingly bogus solution to the same problem: https://pastebin.com/JTrSVySJ

Please ypeace do you have access or links to ebooks that can ground me python's libraries...not those arcane books that are no different from the python documentation oh! Or alternatively do you know of good books I can buy? I need to grasp python well within a short time...your use of the itertools module there was just delicious! I salute your royal pythoness!

Re: Python Programming by Folarinibrahim1(m): 9:41am On May 08, 2018
https://stackoverflow.com/q/50169383/9739450

Someone should help me with the fix to this.
Re: Python Programming by ypeace: 10:45am On May 08, 2018
efficiencie:


Here is my annoyingly bogus solution to the same problem: https://pastebin.com/JTrSVySJ

Please ypeace do you have access or links to ebooks that can ground me python's libraries...not those arcane books that are no different from the python documentation oh! Or alternatively do you know of good books I can buy? I need to grasp python well within a short time...your use of the itertools module there was just delicious! I salute your royal pythoness!


Checkout this free course on udacity==>

https://www.udacity.com/course/design-of-computer-programs--cs212



Make sure you understand python basics very well before starting the course. If your basics are not good, I will advise that you start from sololearn.

1 Like

Re: Python Programming by efficiencie(m): 11:41am On May 08, 2018
efficiencie:
I was playing around with some stuff on decision trees and came up with the following problem. I was able to work out a solution but I think my solution may be too slow and I am hoping someone might have a faster alternative. Here is the problem:

Design a function that accepts a digit; say 'n', and returns a list of lists of unary digits between 0 and 'n-1', pairs of digits between 0 and 'n-1', triples of digits between 0 and 'n-1', up until the '(n-1)-tuple' digits between 0 and 'n-1'.

for example;

if n = 2 the function return: [[0], [1], [0, 1]]
if n = 3 the function returns: [[0], [1], [2], [0, 1], [0, 2], [1, 2], [0, 1, 2]]
if n = 4 the function returns: [[0], [1], [2], [3], [0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]]

cc ypeace, 4kings, Ajibel, adejumoadeoluwa, melodyogonna, alexis, Nobody and co

Thanks to your use of COMBINATIONS in ITERTOOLS, @ypeace, I was able to dig up a one-liner. https://pastebin.com/vnhbc2cJ

I guess I might just have to go the hard way of using the python documentation or the help system on my IDE before taking up serious certification courses online. Thanks for the hint!

Re: Python Programming by ypeace: 12:39pm On May 08, 2018
efficiencie:


Thanks to your use of COMBINATIONS in ITERTOOLS, @ypeace, I was able to dig up a one-liner. https://pastebin.com/vnhbc2cJ

I guess I might just have to go the hard way of using the python documentation or the help system on my IDE before taking up serious certification courses online. Thanks for the hint!


Wow wow.... You are good. Can we chat on WhatsApp? I prefer telegram if you have. 0.8.1.3.7.4.5.7.8.6.2
Re: Python Programming by efficiencie(m): 3:03pm On May 08, 2018
ypeace:



Wow wow.... You are good. Can we chat on WhatsApp? I prefer telegram if you have. 0.8.1.3.7.4.5.7.8.6.2


I'll take down your number sir but Iv got a problem with my phone and I would like to replace it as soon as I can and when I do I'd chat you up asap!
Re: Python Programming by ypeace: 7:35pm On May 08, 2018
efficiencie:



I'll take down your number sir but Iv got a problem with my phone and I would like to replace it as soon as I can and when I do I'd chat you up asap!

Alright.
Re: Python Programming by efficiencie(m): 7:51pm On May 08, 2018
In spirit of one-liners, create a one-liner function that accepts a dictionary with numeric values and returns a dictionary with the maximum value. For example:
i. The function accepts: {'ade': 3, 'john': 5, 'sam': 1, 'bukky': 20} and returns: {'bukky': 20}
ii. The function accepts: {'ade': 3} and returns: {'ade': 3}
iii. The function accepts: {'ade': 3, 'john': 5, 'sam': 20, 'bukky': 20} and returns: {'sam': 20, 'bukky': 20}
Re: Python Programming by ypeace: 12:13am On May 09, 2018
efficiencie:
In spirit of one-liners, create a one-liner function that accepts a dictionary with numeric values and returns a dictionary with the maximum value. For example:
i. The function accepts: {'ade': 3, 'john': 5, 'sam': 1, 'bukky': 20} and returns: {'bukky': 20}
ii. The function accepts: {'ade': 3} and returns: {'ade': 3}
iii. The function accepts: {'ade': 3, 'john': 5, 'sam': 20, 'bukky': 20} and returns: {'sam': 20, 'bukky': 20}

dict_maxx = lambda _dict: {key:value for key, value in _dict.items() if value == max(_dict[key] for key in _dict)}

1 Like

Re: Python Programming by yashgeek: 10:24am On May 09, 2018
Why python is good programming language ? Read This smiley https://featuresunlocker.com/python-good-programming-language-hacking/

1 Like

Re: Python Programming by efficiencie(m): 10:10am On May 10, 2018
efficiencie:
In spirit of one-liners, create a one-liner function that accepts a dictionary with numeric values and returns a dictionary with the maximum value. For example:
i. The function accepts: {'ade': 3, 'john': 5, 'sam': 1, 'bukky': 20} and returns: {'bukky': 20}
ii. The function accepts: {'ade': 3} and returns: {'ade': 3}
iii. The function accepts: {'ade': 3, 'john': 5, 'sam': 20, 'bukky': 20} and returns: {'sam': 20, 'bukky': 20}


Here's mine; https://pastebin.com/xPJjHTqn

1 Like

Re: Python Programming by drwells: 7:26am On May 11, 2018
Am a beginner ooo, just got nairaland account recently. This is really a nice environment to learn

1 Like

Re: Python Programming by waali(m): 11:03am On May 11, 2018
efficiencie:
In spirit of one-liners, create a one-liner function that accepts a dictionary with numeric values and returns a dictionary with the maximum value. For example:
i. The function accepts: {'ade': 3, 'john': 5, 'sam': 1, 'bukky': 20} and returns: {'bukky': 20}
ii. The function accepts: {'ade': 3} and returns: {'ade': 3}
iii. The function accepts: {'ade': 3, 'john': 5, 'sam': 20, 'bukky': 20} and returns: {'sam': 20, 'bukky': 20}

Have been in NYSC orientation camp in the last 23 days, my solution is attached as a pic. For those that need clarification, read the paragraph below too.

- the first part of the return statement returns the key with the highest value

- I used the sorted global function to sort the dictionary using it values in descending order. This function returns the dictionary as a list and using [0] and dic[] , I got the highest values.

- looking at the return statement, you would see that it is enclosed in a dictionary format thereby generating a dictionary of the highest key with it associated value.

1 Like

Re: Python Programming by efficiencie(m): 2:37pm On May 11, 2018
waali:


Have been in NYSC orientation camp in the last 23 days, my solution is attached as a pic. For those that need clarification, read the paragraph below too.

- the first part of the return statement returns the key with the highest value

- I used the sorted global function to sort the dictionary using it values in descending order. This function returns the dictionary as a list and using [0] and dic[] , I got the highest values.

- looking at the return statement, you would see that it is enclosed in a dictionary format thereby generating a dictionary of the highest key with it associated value.

wow! nice...quite easy to understand!
Re: Python Programming by Richkinwe: 7:35pm On May 11, 2018
Hello house, please someone should share links or number of any active Python whatsapp or telegram group for beginners or intermediate.

1 Like

Re: Python Programming by ypeace: 2:31am On May 12, 2018
waali:


Have been in NYSC orientation camp in the last 23 days, my solution is attached as a pic. For those that need clarification, read the paragraph below too.

- the first part of the return statement returns the key with the highest value

- I used the sorted global function to sort the dictionary using it values in descending order. This function returns the dictionary as a list and using [0] and dic[] , I got the highest values.

- looking at the return statement, you would see that it is enclosed in a dictionary format thereby generating a dictionary of the highest key with it associated value.

Nice.
But this solution only returns a value for test (iii).

1 Like

Re: Python Programming by ypeace: 2:32am On May 12, 2018
Richkinwe:
Hello house, please someone should share links or number of any active Python whatsapp or telegram group for beginners or intermediate.

Telegram group: /python or @python

(1) (2) (3) ... (9) (10) (11) (12) (13) (14) (Reply)

Meet Emmanuella Mayaki: Hired By A School In The UK As Coding Instructor / Build A JAMB Result Checking Website To Win 150,000 Naira / Meet Dare Obasanjo Who Works With Microsoft

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