Programming › Re: Python 3: Exercises And Solutions. by iCode2: 8:13pm On Jun 11, 2020 |
Brukx: import random def main() : sentence=input("enter a sentence: " ) list=sentence.split(" " ) new_sentence= random.shuffle(list) new_sentence.capitalise(0) new_sentence.replace(.) new_sentence(len(new_sentence))+("." ) print (', '.join(new_sentence))
main() I got a syntax error from line 7. |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 8:09pm On Jun 11, 2020 |
gbolly1151: Can you cite example out input and output? Input: This boy is a love child of a love God. Output could be: Child god love this a boy is love a of. |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 2:07pm On Jun 10, 2020 |
Write a program that asks the user to enter a sentence and then randomly rearranges the words of the sentence. Make sure that the sentence that will be printed out starts with a capital, that the original first word is not capitalised if it comes in the middle of the sentence, and that the period is in the right place. |
Programming › Re: Chronicle Of A Data Scientist/analyst by iCode2: 6:22am On Jun 07, 2020 |
Grandlord: Lol bro. E no hard like that. Time and effort make the difference. There's a chapter on ATBS specifically focused on web scraping. Maybe you've not read it yet. Lol yea. I dropped ATBS and moved to another book when I was having issues with functions. I'll go back to ATBS when I'm done with the new book. |
Programming › Re: Common good python programming practices you should know by iCode2: 10:30am On Jun 06, 2020 |
|
Programming › Re: Chronicle Of A Data Scientist/analyst by iCode2: 11:44pm On Jun 05, 2020 |
mbhs139: It's a matter of time. Keep on trying, keep on pushing, you'll get there. Hardheolar: Persistency is key. Just keep pushing. I also feel that way when I see some reports. Thanks guys. |
Programming › Re: Chronicle Of A Data Scientist/analyst by iCode2: 7:28pm On Jun 05, 2020 |
Hardheolar: Hi guys, I did further digging on the dataset that cochtrane scraped using a business intelligence tool called Power BI. Note: The analysis is for the date when the thread made it to front page, not when it was created which spanned from 3rd of June 2019 to 2nd of June 2020 . The data has 28,516 threads from 38 different sections by 5025 different accounts.
Few insights from the dataset -dre11 is the king of political threads with 361 threads followed by Islie(329) and ijustdey(225) during the time captured. Lala is more interested in celebrity threads compared to politics, followed by Alex. Ogbiwa is the defending champion of sports threads. -Threads are mostly pushed to front page in the morning, which is reasonable since that is when the day begins. -There was spike in threads that were pushed to front page in July 2019, but I can't tell if that is the norm during that period since we don't have previous year's data to make the comparison. -You will find that threads in religion section top the threads that make it to front page on Sundays, but it came third after politics and celebrity threads. -853 threads made it to front page with "kill" keyword. That is worrisome and a cause of concern. e.tc. Lots of insight can be derived from the data. Below is a link to the report. It is interactive, so feel free to play around with it.
https:///3gXsRlq I wish I can do this already! |
Programming › Re: Programming Learning Challenge June. by iCode2: 9:58am On Jun 05, 2020 |
olaniyi0: I swear my main determination, just for data analysis but e no easy. Are u new to python? Yes. You? |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 10:58pm On Jun 04, 2020 |
scarplanet:
class Solution:
def __init__(self, n): self.n = list(n)
def prog(self): print("Total Number: ", len(self.n)) print("Last Item: ", self.n[-1]) print("Reverse List: ", self.n[::-1]) l = filter(lambda x: x == 5, self.n) print("YES List Contains 5" if 5 in list(l) else "NO List does not contain 5" ) print("Number of fives in list: ", self.n.count(5)) _, *b, _ = self.n print("Sorted list minus first and last elements: ", sorted([*b])) y = filter(lambda x: x < 5, self.n) print("Number less than five: ", len(list(y))) list_elements = eval(input("Enter desired integers separated by comma: " )) sol = Solution(list_elements) sol.prog() Chai! Yours looks so advanced.  I still have a long way to go. Here's my solution myList = eval(input('Enter a list of integers)) #Enter the numbers as well as the square brackets.
print(len(myList)) print(myList[-1]) myList.reverse() if 5 in myList: print(' Yes') else: print('It doesn\' t contain a 5')
count = 0 for i in range(len(myList)): if myList[i] < 5: count += 1 print('There are', count, 'integers less than 5')
del myList[0] del myList[-1] myList.sort() print(myList)
LessThanFive = [] for i in range (len(myList)): if 5 == myList[i]: LessThanFive.append(myList.count(i)) print('5 appeared', len(LessThanFive), 'times.')
|
Programming › Re: Funny Programming Memes. Just For Laughs by iCode2: 8:57pm On Jun 04, 2020 |
|
Programming › Re: Funny Programming Memes. Just For Laughs by iCode2: 4:12pm On Jun 04, 2020 |
ibkayee: Nope, more standard applications development Nice one |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 4:04pm On Jun 04, 2020 |
I've tried my hands on this though. I want to see if someone can answer it a different way. Maybe yours will be better.
Write a program that asks the user to enter a list of integers. Do the following: (a) Print the total number of items in the list. (b) Print the last item in the list. (c) Print the list in reverse order. (d) Print Yes if the list contains a 5 and No otherwise. (e) Print the number of fives in the list. (f) Remove the first and last items from the list, sort the remaining items, and print the result. (g) Print how many integers are less than 5 |
Programming › Re: Chronicle Of A Data Scientist/analyst by iCode2: 12:27pm On Jun 04, 2020 |
cochtrane: I
We will use SQLite. But most of what will be learnt can be extended to MySQL and Postgres. Shoot me a PM if interested. Hopefully we can get some more engagement going here for enthusiasts! Interested! |
Programming › Re: Funny Programming Memes. Just For Laughs by iCode2: 10:11am On Jun 04, 2020 |
ibkayee: Lol I don't know Python, although I was learning it briefly
Only languages I know are Java, C# and C++ (sort of, don't really like it ) My guess is.. You're a mobile dev. Correct? |
Programming › Re: Common good python programming practices you should know by iCode2: 11:44pm On Jun 03, 2020 |
gbolly1151: This my solution might not be best algorithm but it solve it
text = 'amalgamate' stop=text.rfind('a') for i in range(len(text)): if text[i] == 'a': if i != stop: print(i,end=',') else:print(i,end='.')
You're good, man. |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 11:42pm On Jun 03, 2020 |
HappyPagan: No wahala. I think rstrip will work.
'astring'.rstrip(',')
I'm not on my PC now. Will try it once I get home. I don't know this astrip kini yet. I'll read up on it. |
Programming › Re: Funny Programming Memes. Just For Laughs by iCode2: 8:24pm On Jun 03, 2020 |
Light78: Please who can teach me python. I already gat a laptop. I had installed python and Pycharm.
Just to get started.
I really need to learn. I don't care if I debugging a single error takes 10 hours. Just start learning! Download automate the boring stuff and a practical introduction to python programming |
Programming › Re: Common good python programming practices you should know by iCode2: 7:59pm On Jun 03, 2020 |
Should: help me put myself together, I'm going mad already.. Help a Believer  Hmmm I don't understand that screenshot gbolly1151: Just seeing this will check Okay boss |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 7:57pm On Jun 03, 2020 |
HappyPagan: @iCode2
The comma is there because you use
end = ','
On line 4.
If you want to remove the final comma, you can save the final output in a string and use one of the string methods to remove the last comma.
If you want to remove all the commas, maybe you prefer spaces, use
end = ' ' #there is a space between both quotes.
Thanks a lot. I'll try that string method and see. |
Programming › Re: Python 3: Exercises And Solutions. by iCode2: 1:30pm On Jun 03, 2020 |
For this code: text = input('Enter a string: ') for i in range(len(text)): if text[i] == a: print(i, end=',')If i type in 'amalgamate', I'll get the following output: 0,2,5,7, Question: How can I discard that comma after 7? |
Programming › Re: Common good python programming practices you should know by iCode2: 1:26pm On Jun 03, 2020 |
For this code: text = input('Enter a string: ') for i in range(len(text)): if text[i] == a: print(i, end=',')If i type in 'amalgamate', I'll get the following output: 0,2,5,7, Question: How can I discard that comma after 7? |
Programming › Re: Chronicle Of A Data Scientist/analyst by iCode2: 1:19pm On Jun 03, 2020 |
Cochtrane
You're just 6 months into Data Science? Wow Can I pm you and probably talk on WhatsApp? |
Programming › Re: Programming Learning Challenge June. by iCode2: 12:40pm On Jun 03, 2020 |
AududuNine11: which field do you intend applying both? Data analysis. Some back end too. |
Programming › Re: Programming Learning Challenge June. by iCode2: 11:50am On Jun 03, 2020 |
Python and SQL! |
Programming › Re: Programmers Chat Room. by iCode2(op): 2:13pm On May 29, 2020 |
Grandlord: Functions can look a bit confusing but it's simple. Think of it like a packaging for codes you'd like to use several times. Just keep at it, you'll get the hang of it in no time  Yea, true that.. |
Programming › Re: Programmers Chat Room. by iCode2(op): 12:22pm On May 29, 2020 |
|
Programming › Re: Programmers Chat Room. by iCode2(op): 11:40am On May 29, 2020 |
Grandlord: I've looked at it. I think it's a great and engaging way to learn programming concepts by building games.
I'm building a 2D Android game app right now on Android studio. It's engaging, stimulating and fun. It's more fun than web development and data science. Lol. Yea, I think so too. You get to use what you're learning which makes it exciting. You're building an android game? That's great! You got your hands on java? Or can you build on android studio with Python? |
Programming › Re: Programmers Chat Room. by iCode2(op): 8:03am On May 29, 2020 |
Grandlord: No bro. I haven't. How's it like? I'm yet to use it sha. I saw someone on twitter upload a video of a game she created through the book. |
Programming › Re: Programmers Chat Room. by iCode2(op): 8:02pm On May 28, 2020 |
Grandlord
Have you seen the book 'Invent your own computer game with Python' by AI Sweigart? |
Programming › Re: A 30 Day Coding Challenge (Python) For BEGINNERS by iCode2: 2:35pm On May 27, 2020 |
amadiwati: The error has been corrected Still not working. |
Programming › Re: Funny Programming Memes. Just For Laughs by iCode2: 2:28pm On May 27, 2020 |
|
Programming › Re: Funny Programming Memes. Just For Laughs by iCode2: 8:43pm On May 25, 2020 |
crownedrookie: You know why I mentioned you right Yea  I later got the 8GB Ram and I'm loving every bit of it! |