You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython
def get_row(result_dice: int):
slot_values = {
1: ('1'),
2: ('2'),
3: ('3'),
4: ('4'),
5: ('5'),
6: ('6'),
}
return ', '. join(slot_values.get(result_dice)).capitalize()
It seems so and there are no errors except return for some reason
Читать полностью…IndentationError: unindent does not match any outer indentation level
Читать полностью…why does return give an error with a red underline?
def get_row(result_dice: int):
slot_values = {
1: ('1'),
2: ('2'),
3: ('3'),
4: ('4'),
5: ('5'),
6: ('6'),
}
return ', '. join(slot_values.get(result_dice)).capitalize()
I'm working on an open-source Python package called payman
— it's designed to unify multiple Iranian payment gateways (like ZarinPal, Zibal, etc.) under a clean and simple interface.
I want to follow the "Program to interfaces, not concrete classes" principle and support different gateways with potentially different behaviors and method sets. My idea is to pass a gateway instance (like ZarinPal(...)) into a central wrapper class called Payman, and then use Payman directly to call the gateway's methods.
Here’s the problem:
Even though delegation works at runtime (via getattr, composition, or other tricks), my Payman instance doesn’t show method suggestions in the IDE (no autocomplete), which is frustrating for usability.
I want Payman(gateway=ZarinPal(...)) to behave exactly like ZarinPal(...) in terms of code completion and typing — without re-defining all the methods manually.
If anyone has ideas or experience with this kind of wrapper + typing delegation (and making IDEs like PyCharm happy), I’d really appreciate the help 🙏
Here’s the GitHub repo again if you want to check it out or suggest improvements:
https://github.com/irvaniamirali/payman
Thanks in advance!
https://wiki.python.org/moin/BeginnersGuide/NonProgrammers
Читать полностью…It seems to me that the point is in the word. That is, there must be a pair of key and meaning
Like "rice": "60" and etc
dp.add_handler(CommandHandler('start', start))
dp.add_handler(CommandHandler('ajuda', ajuda))
Other commands work fine like Pip , install, unzip, sudo, wget etc. Just this "import" command giving error.
Читать полностью…thats the task actually i want it to remain as it is just that i want user to enter anything (RICE,rice,RiCe) it should accept
Читать полностью…yes but if i convert the input to lower() its wont work because of case sensitivity
Читать полностью…Check out @PythonRes, a channel for Python resources - video courses, pdf books, tutorials and other info to help you learn Python.
Читать полностью…There's no point in wrapping a class or an object to make it behave just like that original object. That's not abstracting common functionality and the IDEs won't know what fields the object or class have unless you tell it explicitly. But as said, there's no point in doing that, since even you will have one class that works with different objects under the hood, they work differently. Unification of usage works in the sense that you define the methods of a superclass that you need for processing the payments and you will only use those methods.
https://www.pastebin.cz/en/p/VMWDpBZ
Obviously this is an example and therefore kept simple. By no means you are limited to a single method. It's quite likely that you will need to have more.
This group is to help you on specific issues you have on YOUR code, so you have to show the code you wrote and explain where and why you are stuck... as simple as that
Читать полностью…1 2 3 4 5 26 27 28 29 30
6 7 8 9 22 23 24 25
10 11 12 19 20 21
13 14 17 18
15 16
Hi
I am a fresher in python
I don't have a coding background
I need a guidance in studying python
Can someone tell me where to start and how to study python
Thanks in advance 😊
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like:
- https://dpaste.org
- https://hastebin.com
- https://bin.kv2.dev
If you posted a wall of text, go back and delete it.
Is there anyone have fresher Python interview questions and answers
Читать полностью…There is a method on strings - capitalize()
https://docs.python.org/3/library/stdtypes.html#str
Well yeah, it makes sense
Just make your keys in a dict lowercase
Or capitalize the input
The element in Groceries
is Rice
not rice
Notice the capital letter
You only lowercase it in checking for q
but the rest remains as you type it in