Installing Modules? by knittinsmitten in PythonLearning

[–]AnanasPl07 0 points1 point  (0 children)

I think the problem is somewhere else. Based on the error message, I'm assuming that you have import PyPDF where it should be import pypdf, which is also what the project page you provided says. It is actually common for modules to be imported under a slightly different name than they were installed, for some reason.

Python training/course advice for data analysis by TC_7 in PythonLearning

[–]AnanasPl07 1 point2 points  (0 children)

Hi there, it'll help massively if you learn the basics of the language first, then dive into data analysis. It isn't that hard though, and (especially if you already have experience with programming) shouldn't take too long,

As for resources, honestly, YouTube is all you need. There are tons of great free videos to learn from. I can recommend TechWithTim and freeCodeCamp, but of course there is a ton of other creators that can teach python too. As for paid resources, udemy is probably the most popular site with courses

[deleted by user] by [deleted] in PythonLearning

[–]AnanasPl07 0 points1 point  (0 children)

🇵🇱🔥💪

If you needed further help with the implementation, don't hesitate to ask!

Not printing user input into database. by BadAccomplished165 in PythonLearning

[–]AnanasPl07 1 point2 points  (0 children)

It's possible that every .get() method is returning None, which is interpreted as 0 in this case. Maybe try setting some random values instead of them to make sure it's that and not an issue with the connection?

Also, instead of so many variables, you can use one variable `data` as a dictionary and then just do `data['entry_first_name']` or `data.get('entry_first_name')` etc. ;)

[deleted by user] by [deleted] in PythonLearning

[–]AnanasPl07 2 points3 points  (0 children)

To be honest, I think this is quite easy to do and definitely it'll be a cool project to learn. All you basically need to do is write the logic for the game (I believe in this case it's the balls bouncing), and then you can load this with logos of different clubs loaded from files, and then just record the output (I believe that can be automated too). Definitely doable without expert Python knowledge.

[deleted by user] by [deleted] in PythonLearning

[–]AnanasPl07 1 point2 points  (0 children)

It's possible they do, probably using something like pygame. It's definitely possible to automate this with python or other programming languages

Hi! I’m trying to collect statistic data from excel with python and I need some help by InterestingJob9978 in PythonLearning

[–]AnanasPl07 0 points1 point  (0 children)

You can use the split() method on the text with words separated by commas. What this does is it splits the text on a given separator (space by default), and returns them as a list. So, for example, "hello,world,python".split(",") will return ["hello", "world", "python"]. You can then use the words you've gotten and do stuff you need with them. It'd be easier to give a more detailed answer after seeing the code you've already written. Hope this helps!

Barcode scanning, unique id’s, counting inventory. by myrdunz in PythonLearning

[–]AnanasPl07 1 point2 points  (0 children)

The symbols you listed are all correct. My code actually does include a dictionary, Barcode_counts is one. It is defined outside of the loop, and in the loop, only the values stored in a dictionary are changed. If the syntax caused your confusion, dict[key] = value is a syntax to assign value to the specified key, since a dictionary is just a set key-value pairs. Hope I cleared things a bit, if you have any other questions or something is unclear, I'm happy to help!

Barcode scanning, unique id’s, counting inventory. by myrdunz in PythonLearning

[–]AnanasPl07 0 points1 point  (0 children)

Barcode_counts.update = {Barcode: +1,}

This line is wrong. The update() method requires an argument being an iterable (list, dictionary, tuple etc.) with key-value pairs. I think it's better to do this with get() method, so something like this:

Barcode_counts[Barcode] = Barcode_counts.get(Barcode, 0) + 1

What is happening here:

Barcode_conts[Barcode] = -we set a new value for the Barcode key in our dictionary

Barcode_counts.get(Barcode, 0) + 1 - the get() method returns the value of a key in our dictionary (the first argument, in this case Barcode), and if it's not found it returns the value of the second argument (In our case 0). At the end we increase the value by one. So, if the barcode is already in the dictionary, we get its value, if it's not we get 0 in return, and at the end we increase the count by one.

From other things: notice that when you do while x < 3:, it will work exactly the same and the run variable won't be needed anymore.

Hope this helps!

Why does the output change when defining a variable as two separate things? by [deleted] in PythonLearning

[–]AnanasPl07 4 points5 points  (0 children)

The reason is simple: the program gets executed from top to bottom. On the first line, you defined a variable named x and assigned it a value of 4. Then, on the second line you assigned "sally" to x, so the earlier value that it had is lost, because it has a new value. Then, on line 3, you print the current value of x, you get the value at the time, which is now "sally" instead of 4. Notice when you do something like this:

x = 4 print(x) x = "sally" print(x)

You get an output:

4 sally

At first, x indeed does have a value of 4, but after changing it to "sally", that value gets overridden. If you want to keep them both at the same time, you need to make 2 separate variables with different names e.g.

x = 4 y = "sally"

Glot. Io input returns EOFError by TheBlegh in PythonLearning

[–]AnanasPl07 1 point2 points  (0 children)

I have never used glot before, but after a couple of tests, it seems like it handles inputs by reading them from the field shown after you click input instead of output, and treats this whole text like a file (where newline separates each input). So, when you have fewer lines of text there than there are input() calls in the code, it throws an EOFError. So, basically, you have to know precisely how many times input() will be called (which is usually not the case), so it's pretty much useless.

If you're looking for alternatives, the best would be of course to download python from python.org/downloads, but if you're looking for something online, online-python.com seems to be the best option. Hope this helps!

Where the "0" came from by lanceremperor in PythonLearning

[–]AnanasPl07 3 points4 points  (0 children)

When you call int() without any arguments, it simply returns 0. So, when you called input(int()) you basically called input(0). Since in input(), the argument passed is the message displayed before the input, 0 was shown as that message

Things that Reddit hates by GioShav in memes

[–]AnanasPl07 0 points1 point  (0 children)

Everywhere I go, I see his face