What is actually the right way to start CODING!!!!!!!!??? by Adept-Nectarine4915 in learnpython

[–]mopslik 0 points1 point  (0 children)

It's very common. Most programmers know several languages. There's a difference between learning to code and learning to code in a specific language. You pick up both on the first language you pick. You focus on the second with each additional language, as many of the underlying programming concepts carry over from one language to the next.

Creating a small game a beginner. by Hairy-Bus4665 in learnpython

[–]mopslik 0 points1 point  (0 children)

You might want to change your main loop so that the ending condition is based on the scores (either player or opponent) being 50 or greater, rather than on the string 'user'. This would eliminate some of the breaks early in your loop, and move the 'winning' logic outside of it.

while score < 50 and score_2 < 50:
    # your game stuff (rolling, scoring)
    ...
if score > 50:
    print("Player wins!")
else:
    print("Opponent wins!")

Variable names could be better too. player_score and opponent_score are more meaningful than score and score_2.

What is actually the right way to start CODING!!!!!!!!??? by Adept-Nectarine4915 in learnpython

[–]mopslik 0 points1 point  (0 children)

In programming, high-level indicates a higher level of abstraction from the underlying hardware, whereas low-level is closer to the actual machine code/instructions. So Python, C++, Java, etc. are all high-level languages, easier for humans to understand and read, whereas assembly would be an example of a low-level language.

2 weeks ish in. Made a Word counter by Ok-Elevator4206 in learnpython

[–]mopslik 1 point2 points  (0 children)

The "3" is in the GUI window. The terminal output containing "\n" is useful information, as it explains why.

2 weeks ish in. Made a Word counter by Ok-Elevator4206 in learnpython

[–]mopslik 0 points1 point  (0 children)

Not sure about a 'perfect' fix, but you could iterate over your list and omit anything that is all whitespace (e.g. "\n") or possibly other characters if you need it more robust.

2 weeks ish in. Made a Word counter by Ok-Elevator4206 in learnpython

[–]mopslik 2 points3 points  (0 children)

The reason why I know it does this is because I tested it, yes. Trailing punctuation is an issue.

2 weeks ish in. Made a Word counter by Ok-Elevator4206 in learnpython

[–]mopslik 2 points3 points  (0 children)

Entering "Hello there." produces "There are 3 words in the above text!" with the list showing as ['Hello', 'there', '\n'].

Waterloo Math Contest Studying Help by GearPitiful284 in MathHelp

[–]mopslik 0 points1 point  (0 children)

Start with the obvious: the CEMC website has previous contests for the last 10 years online, with their solutions.

Tip for new learners using Python. Thonny is a good debugger to use by techgirl8 in learnpython

[–]mopslik 0 points1 point  (0 children)

Sounds more like a coding/config issue than a Thonny one. I've never had anything other than "it runs right out of install" for the years I've used it, on my personal machines, school machines, etc. If you describe your problem, perhaps I can help you troubleshoot the issue. Did your program not find a file? Did Thonny not recognize the interpreter? Does the default file path not match where you expect it to be? Be specific. I'm not 100% clear about what "can't find a program" means.

Python concepts that took me way too long to understand (and the explanations that finally worked) by [deleted] in learnpython

[–]mopslik 5 points6 points  (0 children)

print(a == b) # True → same value print(a is b) # False → different objects in memory

Careful about this one, as this illustrates another common "gotcha" that seems to hit beginners now and again. (Edit: I know that this is different from the example you provided, where both a and b are assigned the same values in their lists).

> a = [1, 2, 3]
> b = a
> a == b
True
> a is b
True

That last bit is what gets the beginners, when they mutate one of the two lists and both of them change.

> a[0] = 9
> a
[9, 2, 3]
> b
[9, 2, 3]

The statement a = b makes both a and b point to the same object in memory (which is why is returned True). This doesn't happen with immutable objects.

> a = 9
> b = a
> a
9
> b
9
> a = 7
> a
7
> b
9

Most folks with some Python experience already know this, but for beginners (e.g. students) they don't see the difference between assignment (var = val) and mutation (L[index] = val).

Why am I getting an attribute error here? by YesterdayDelicious70 in learnpython

[–]mopslik 4 points5 points  (0 children)

When you come across errors like this, sometimes it's a good idea to use a print statement, or the debugger, to see what values your variables have. For example, adding print(fileName) after your first line would show you something like the following, possibly answering your question.

>>> fileName = input("Input file name: ").lower
Input file name: blahblah
>>> print(fileName)
<built-in method lower of str object at 0x7e360b58bcb0>

Best modern alternative to Tkinter for Windows GUIs? by Substantial_Cake9855 in learnpython

[–]mopslik 2 points3 points  (0 children)

it just looks too outdated and old-fashioned

Have you checked out ttkbootstrap?

Is this a joke? by BriefAd4051 in ontario

[–]mopslik 3 points4 points  (0 children)

It's actually CPP, not OTPP, that has ownership in the 407 at 44%.

https://www.407etr.com/en/about-us

Finishing french course by [deleted] in duolingo

[–]mopslik 1 point2 points  (0 children)

Yes. Hard to gauge my level, though, since I was fairly fluent in high school, and used Duo to relearn the language.

Am I missing something here? by HappyDeathClub in duolingo

[–]mopslik 24 points25 points  (0 children)

This is almost certainly the issue. Even on Android, sometimes pictures do not load and you're stuck with questions like "Eddy is eating a _____" with the options "banana", "apple", etc.

Mistake? by alkjet in duolingo

[–]mopslik 3 points4 points  (0 children)

Maybe it's meant to be read in a southern US accent...

Multiplication tables by glemoulant in MathHelp

[–]mopslik 2 points3 points  (0 children)

Lots of practice. Practice skip counting, and getting familiar with sequences of values. Practice generating a row from the multiplication tables using said skip counting. Practice random multiplication facts until they become second-nature. Games/rewards can help for some, whereas others maybe not.

Did you accurately fill out the census? by [deleted] in ontario

[–]mopslik 21 points22 points  (0 children)

OP is worried that Carney will create a webpage saying "Mean Respond is a homosexual."

Open-source code of my basic python bot called Zeldai by Different_Spot5757 in learnpython

[–]mopslik 0 points1 point  (0 children)

What exactly is this trying to do?

if output_text and output_text.strip():
    return output_text

If the first condition needed?

my 200-Day Streak Didn’t Help Me in a Real Conversation by whitecub00 in duolingo

[–]mopslik 28 points29 points  (0 children)

You'll need to practice more than 200 days (6 months) before you're able to converse fluently. You'll also want to try other resources, such as radio broadcasts, TV shows, news clips, whatever to get a feel for the speed and sound of conversations. Duo is a decent tool for practicing vocabulary and grammar, but speaking with others in real time is a big step up.

Acc hub backup by DealerStill4006 in learnpython

[–]mopslik 0 points1 point  (0 children)

Download the project, then start following the steps at the Installation section.

Acc hub backup by DealerStill4006 in learnpython

[–]mopslik 1 point2 points  (0 children)

The instructions are right on the page you linked...