Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,250 members, 7,807,853 topics. Date: Wednesday, 24 April 2024 at 08:45 PM

Python Programming - Programming (13) - Nairaland

Nairaland Forum / Science/Technology / Programming / Python Programming (61644 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) ... (10) (11) (12) (13) (14) (Reply) (Go Down)

Re: Python Programming by waali(m): 8:20am On May 12, 2018
ypeace:


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

Eyes for details.... Good one. While reading the problem, I only read the first two examples and coupled with the use of language in the problem ( returns a dictionary with the maximum value.). No excuse though, I should have think towards that direction even without been told. Thanks man!
Re: Python Programming by Richkinwe: 9:59am On May 12, 2018
ypeace:

Telegram group: /python or @python
Thanks
Re: Python Programming by efficiencie(m): 4:41am On May 14, 2018
Another one-liner for this problem:

Construct a function that accepts a dataset, which is a list of lists, and returns a dictionary with the keys of the dictionary being the last element of every inner list and the values of the dictionary are the corresponding probabilities of the elements.

for example:

if dataset = [['yes', 'yes', 'yes'], ['yes', 'yes', 'yes'], ['yes', 'no', 'no'], ['no', 'yes', 'no'], ['no', 'yes', 'no']] is passed to the function it returns {'no': 0.6, 'yes': 0.4}

if the dataset = [['love', 1, 3], ['hate', 2, 3], ['indifferent', 1, 4], ['hate', 3, 3]] is passed to the function it returns {3: 0.75, 4: 0.25}

I already have a one-line solution and would like to compare with more efficient solutions!

ypeace, waali, Richkinwe, hilaryxoxo and co
Re: Python Programming by J0sh007: 8:37am On May 14, 2018
Please guys i need help with a python program within an hour. anyone that can help me write the program and screenshot the code or post the screenshot here pls i only have one hour and dont have a clue about phyton.


a program that inputs a 5 digit number and seperates the number into individual digits and prints the numbers separated by 3 spaces. thanks in addy
Re: Python Programming by efficiencie(m): 1:24pm On May 14, 2018
J0sh007:
Please guys i need help with a python program within an hour. anyone that can help me write the program and screenshot the code or post the screenshot here pls i only have one hour and dont have a clue about phyton.


a program that inputs a 5 digit number and seperates the number into individual digits and prints the numbers separated by 3 spaces. thanks in addy

Study bro! I think this might help. See the attached.

1 Like

Re: Python Programming by waali(m): 2:14pm On May 14, 2018
efficiencie:
Another one-liner for this problem:

Construct a function that accepts a dataset, which is a list of lists, and returns a dictionary with the keys of the dictionary being the last element of every inner list and the values of the dictionary are the corresponding probabilities of the elements.

for example:

if dataset = [['yes', 'yes', 'yes'], ['yes', 'yes', 'yes'], ['yes', 'no', 'no'], ['no', 'yes', 'no'], ['no', 'yes', 'no']] is passed to the function it returns {'no': 0.6, 'yes': 0.4}

if the dataset = [['love', 1, 3], ['hate', 2, 3], ['indifferent', 1, 4], ['hate', 3, 3]] is passed to the function it returns {3: 0.75, 4: 0.25}

I already have a one-line solution and would like to compare with more efficient solutions!

ypeace, waali, Richkinwe, hilaryxoxo and co

The screenshot is attached below.

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


The screenshot is attached below.

Nice one boss...here is mine: https://pastebin.com/Ah1EJ2gq

Re: Python Programming by J0sh007: 8:39pm On May 14, 2018
Thanks guys for the help even though it was a bit late. I guess u guys were busy during that time. this was the code that i used

num=raw_input("input a 5 digit number")
print " ".join (str(i) for i in num)



and i added a line for an error message incase the input was not 5 digits but i dnt have it now
Re: Python Programming by Tech9900: 7:55am On May 17, 2018
.
Re: Python Programming by Bellamoney(m): 12:36am On Sep 09, 2018
This thread looks abandoned
Re: Python Programming by Ladyhussle(f): 9:34am On Sep 10, 2018
Hi guys please I need recommendation on the specifications of a computer that would be suitable for python programming. I don't have money for Apple Mac please.
Re: Python Programming by dragnet: 9:06pm On Sep 10, 2018
Ladyhussle:
Hi guys please I need recommendation on the specifications of a computer that would be suitable for python programming. I don't have money for Apple Mac please.
what's your budget?
Re: Python Programming by Ladyhussle(f): 5:01am On Sep 11, 2018
80k
Re: Python Programming by BetaTechnicians: 12:57pm On Sep 11, 2018
Ladyhussle:
80k

https://www.nairaland.com/4720571/usa-used-hp-pavilion-g6

https://www.nairaland.com/4587882/usa-used-gaming-hp-elitebook-8460p

Check these, they're powerful for programming and graphics. or you can send me messages via WhatsApp for others.
Re: Python Programming by HarshS(m): 8:35am On Sep 12, 2018
Python is now the 3rd most popular language ranked by the TIOBE index. I would like to share what to do to learn Python in quick time.
You need a good Python tutorial which teaches you the proper syntax, rules to write code, how to add comments, format your code, tell about the native data types, control-flow statements like loops, if-condition, exception handling, file I/O and so on.
There should be enough examples which you can follow to understand how to code in Python. Here are a few good online resources to learn in that manner.

1. Python tutorial to learn programming step by step from TechBeamers
-> https://www.techbeamers.com/python-tutorial-step-by-step/
2. Basic Python for quick learning from Programiz
-> https://www.programiz.com/python-programming
Re: Python Programming by kuhak8: 11:16am On Sep 13, 2018
HarshS:
Python is now the 3rd most popular language ranked by the TIOBE index. I would like to share what to do to learn Python in quick time.
You need a good Python tutorial which teaches you the proper syntax, rules to write code, how to add comments, format your code, tell about the native data types, control-flow statements like loops, if-condition, exception handling, file I/O and so on.
There should be enough examples which you can follow to understand how to code in Python. Here are a few good online resources to learn in that manner.

1. Python tutorial to learn programming step by step from TechBeamers
-> https://www.techbeamers.com/python-tutorial-step-by-step/
2. Basic Python for quick learning from Programiz
-> https://www.programiz.com/python-programming
3. Learn the Python Tutorial from Python Expert
-> https://www.pybeginner.org/python/
Re: Python Programming by kuhak8: 11:19am On Sep 13, 2018
jacob05:
>>>print "Hello, World"


>>> print "Has any body tried his or her hands in python and what are your experiences and views using it"

If you want to learn full Python step by step tutorial from Python expert, then visit here,
-> https://www.pybeginner.org/python/
Re: Python Programming by Avast(m): 8:52pm On Dec 19, 2018
anyone still here?
I am new to Python, have migrated to using NUMPY and PANDAS on Jupyter because I want to go into Data science. I am looking for where to apply my knowledge or to lay my hands on real life data to practice
Re: Python Programming by honingds: 12:51pm On Dec 28, 2018
Learn more about raw_input function used in this code sample from the blog here.

https://honingds.com/blog/raw_input-python/
Re: Python Programming by NameError(m): 6:49pm On Dec 28, 2018
Avast:
anyone still here?
I am new to Python, have migrated to using NUMPY and PANDAS on Jupyter because I want to go into Data science. I am looking for where to apply my knowledge or to lay my hands on real life data to practice

Kaggle.
Re: Python Programming by marryplo: 9:17pm On Dec 28, 2018
Please share your projects ooo.

at least to improve our selfs.

i will go first https://shop4react.herokuapp.com/
Re: Python Programming by proffmanue(m): 3:38pm On Dec 29, 2018
Guys I need a good pdf book for Python beginner. Thks
Re: Python Programming by sudo1986: 7:32pm On Apr 27, 2019
Please who can help me to solve this problem.....abeg i need your help senior


Create a program named Dice to solve the following exercises. The input of the program is a so-called trial, i.e. a sequence of the rolled results. This input must be read from the standard input. The first line of the input contains a single integer N, indicating the number of throws . The second line of the input contains exactly N characters, each character is a digit from 1 to 6.

The output of the program should be written to the standard output. There are 3 exercises you are expected to solve. The output should contain exactly 3 lines: the ith line in the output is the solution to exercise i.

Exercise 1
How many times did it occur in the trial, that exactly two 6s were rolled after each other? For example, in sequence 56611166626634416 it occurred twice, that exactly two 6s were thrown after each other.

Exercise 2
Find the length of the longest subsequence of successive rolls, in which the value 6 does not occur. (This number can be zero, if only 6s were thrown.) For example, in the trial 66423612345654 the longest subsequence of successive rolls in which the value 6 does not occur is 12345. Its length is 5.

Exercise 3
We shall call a sequence of successive rolls in the trial a lucky series, if the sequence contains only 5s and 6s. For example 6556665 is a lucky series, with a length of 7.
Find out, which is the most frequent length for lucky series. If there are more than one "most frequent" lucky series lengths, print the longest. If there are no lucky series in the trial, print zero.

Be aware. We are not interested in the most frequent lucky series. The four lucky series 656, 555, 556 and 666 are equivalent for us, all of them are lucky series of length three. We are looking for the most frequent length of lucky series.

For example, in trial 5533661656, the series 656 is the longest lucky series. But there is only one lucky series of lenght three in the trial. 55 and 66 are also lucky series. This is why the correct answer is 2. In trial 456116513656124566 both the lucky series with length of 2 and 3 occur twice, there is a tie between them. Now the length of the longest (that is 3) should be printed. Examples example1 and example2 are aimed to make this situation clear.
Re: Python Programming by ypeace: 2:54pm On Apr 28, 2019
sudo1986:
Please who can help me to solve this problem.....abeg i need your help senior


Create a program named Dice to solve the following exercises. The input of the program is a so-called trial, i.e. a sequence of the rolled results. This input must be read from the standard input. The first line of the input contains a single integer N, indicating the number of throws . The second line of the input contains exactly N characters, each character is a digit from 1 to 6.

The output of the program should be written to the standard output. There are 3 exercises you are expected to solve. The output should contain exactly 3 lines: the ith line in the output is the solution to exercise i.

Exercise 1
How many times did it occur in the trial, that exactly two 6s were rolled after each other? For example, in sequence 56611166626634416 it occurred twice, that exactly two 6s were thrown after each other.

Exercise 2
Find the length of the longest subsequence of successive rolls, in which the value 6 does not occur. (This number can be zero, if only 6s were thrown.) For example, in the trial 66423612345654 the longest subsequence of successive rolls in which the value 6 does not occur is 12345. Its length is 5.

Exercise 3
We shall call a sequence of successive rolls in the trial a lucky series, if the sequence contains only 5s and 6s. For example 6556665 is a lucky series, with a length of 7.
Find out, which is the most frequent length for lucky series. If there are more than one "most frequent" lucky series lengths, print the longest. If there are no lucky series in the trial, print zero.

Be aware. We are not interested in the most frequent lucky series. The four lucky series 656, 555, 556 and 666 are equivalent for us, all of them are lucky series of length three. We are looking for the most frequent length of lucky series.

For example, in trial 5533661656, the series 656 is the longest lucky series. But there is only one lucky series of lenght three in the trial. 55 and 66 are also lucky series. This is why the correct answer is 2. In trial 456116513656124566 both the lucky series with length of 2 and 3 occur twice, there is a tie between them. Now the length of the longest (that is 3) should be printed. Examples example1 and example2 are aimed to make this situation clear.

check out my solution here: https://hastebin.com/osesajedog.py


the first exercise is a bit tricky. It says exactly two 6s... I interpreted that to mean 6666 and 666666 are wrong. You can add further tests using my checker function.

Note that my solution didn't cater for edge cases like 'No user input' or 'non-integer input values'.

Re: Python Programming by ypeace: 8:56pm On May 02, 2019
marryplo:
Please share your projects ooo.

at least to improve our selfs.

i will go first https://shop4react.herokuapp.com/

I do more of cli and backend apps than web apps but you can checkout https://multisend.co - it is an ethereum dapp that can be used to send ethereum and ethereum tokens to multiple addresses in a single transaction. It can also import addresses and amounts from Google sheet. I did the last part with python. Front end with react and the eth smart contract was written in vyper. I also have the solidity version on my GitHub
Re: Python Programming by calculus4life: 12:29am On Jul 05, 2019
Hello, I just started learning python through tutorial videos and I'm a newbie in programming my problem is I forget things I learnt after the videos so this make it so boring, pls how can I improved on it. Thanks
Re: Python Programming by melodyogonna(m): 9:11am On Jul 07, 2019
calculus4life:
Hello, I just started learning python through tutorial videos and I'm a newbie in programming my problem is I forget things I learnt after the videos so this make it so boring, pls how can I improved on it. Thanks
type the codes as you watch the videos. ebooks will be better suited for that at the moment so get an ebook. learn Python the hard is a great start
Re: Python Programming by calculus4life: 11:11pm On Jul 07, 2019
Okay. Thanks we try it out
Re: Python Programming by vaishnavi068: 6:46am On Jul 08, 2019
Are you interested in learning the most preferred programming language 'AWS Course'? Then Intellipaat AWS course helps you master AWS from scratch to advance level. Intellipaat is a famous eLearning platform who are known to provide the best AWS, python, data science course and much more. For more details visit us here:-
https://intellipaat.com/aws-certification-training-online/
Re: Python Programming by thelino: 8:37pm On Jul 08, 2019
It’s never too late to start. Join our thread here. We are a working group of web and mobile app professionals providing you with free and concise programming courses to get you started from zero to hero

Join our thread here
http://tweetszone.com/section/programming

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