I have been, off and on, dealing with trying to learn python (though not doing so well…)
The major issue I’m having is that I can’t ask the instructor of the Udemy class I’m taking what I’m doing wrong.
So I went back (now that I “have” you all to bounce stuff off) today and I’m stuck on day 9 of 100 days (it’s taking me weeks per “day” but I digress) – I wrote some code but can’t find it and am totally lost (It’s been a while since I “attacked” the problem – it’s an assignment to write a “test if this number is prime” program. – now I know that there are few numbers to check (I’ve been doing it in my head for years) – Prime numbers (other than 5 since any number ending in a 5 is divisible by 5 so only 5 is a prime) up to the square root of the number being tested – so if you’re checking, say, 119 – you know it can’t be more than 11 since 11^2 us 121 – so you need to check 3, and 7 since 9 is not prime and even numbers (other than 2 there are no prime even numbers since they are all divisible by 2) and 11 clearly doesn’t go into 119…
So I know the way to do it in my head so I need to figure out how to do it in Python – or some coding language.
There is going to have to be some functions, I would think – one to divide numbers into the input number – does python have recursion? It would seem to me a recursive function that checks lower primes to divide into the input number…Am I rambling???
Anyway, is there anyone here who “speaks fluent” Python and can help me with this???
One important thing always to do is not recreate the wheel (no matter how much you want to do that). I looked up “test if this number is prime python” and a full array of previously written code came up in the search. Here’s an example: Python Program to Check Prime Number There’s also stuff from stackoverflow and geeksforgeeks.org that might get your creative juices flowing. Different programmers have different solutions, so there are examples of all kinds and not just “one” approach. I’m seriously impressed you can to the math in your head! Wish I could be more help, but I’m just a beginner on python, as well.
Thanks – I’m sure there are already functions or the like (pieces of code???) written for this, but the idea is for me to learn. But syntax is always the hardest part because you have to know the specific syntax for the specific language (like is there nothing at the end of a “sentence” or a comma, a semi-colon, a period or do different punctuation marks designate different purposes.
Well, if you have the stamina to do it from scratch, keep marching forward. My own preference is to beg, borrow or steal from anywhere else to help me get going. Of course, as time goes on and the work (and syntax) become more embedded in my brain, there’s a lot more whining and much less “borrowing”. Still, there’s so much help out there, I’m sure you’ll find a way to get started. Recently, I learned about Thonny, which is a debugging tool for python. Many distros have it built in, so you can check your software manager or repository. It is useful in some ways because it is soooooooooo explicit about the errors that correcting syntax errors got a whole lot easier.
I LOVE this attitude. I think a lot of the younger generation are hurting themselves by not learning how to properly write code, or learn how it works.
I actually programmed back in the late 80s, early 90s and I was trained pretty well. But I’m just not connecting yet with the Python. I just started a web developer class this week – I’ve done HTML before and I took a class in CSS (I think it was on Khan Academy???) but I’m reviewing the HTML now – the third part of the course is JavaScript (which I don’t know, so that’ll be new).
I hope I connect with the Python code at some point
When it comes to reliable academic support, New Assignment Help Australia stands out! I used their Python Assignment Help service last month, and it truly made a difference in my grades. The assignment was delivered ahead of the deadline, and the code was flawless, complete with comments explaining each section. What impressed me most was their customer service team, which kept me updated throughout the process. If you’re looking for a dependable service provider for coding or any academic needs, give them a try
I took Jeff.Pro’s beginners python course and it gave me a good foundation. I’ve coded in the past so the basics were understood, just needed to learn the language & syntax. Such a powerful tool!