Game Bug (python and pygame(: flashing text /u/Nikko_the_Rabbit Python Education

Game Bug (python and pygame(: flashing text /u/Nikko_the_Rabbit Python Education

I have a very primitive python game about a drone on a spaceship. There is a function that creates a tablet (lines 150-382), which I hoped would be the center of my information return to the ‘audience,’ but any text I blit onto the tablet flashes horribly and I can’t fix it. I am very much an amateur and was hoping someone better at code might know what is wrong. link the github:

Nikko-R-M/Spaceship-Game: A drone on a ship doing little things (in very primitive state)

submitted by /u/Nikko_the_Rabbit
[link] [comments]

​r/learnpython I have a very primitive python game about a drone on a spaceship. There is a function that creates a tablet (lines 150-382), which I hoped would be the center of my information return to the ‘audience,’ but any text I blit onto the tablet flashes horribly and I can’t fix it. I am very much an amateur and was hoping someone better at code might know what is wrong. link the github: Nikko-R-M/Spaceship-Game: A drone on a ship doing little things (in very primitive state) submitted by /u/Nikko_the_Rabbit [link] [comments] 

I have a very primitive python game about a drone on a spaceship. There is a function that creates a tablet (lines 150-382), which I hoped would be the center of my information return to the ‘audience,’ but any text I blit onto the tablet flashes horribly and I can’t fix it. I am very much an amateur and was hoping someone better at code might know what is wrong. link the github:

Nikko-R-M/Spaceship-Game: A drone on a ship doing little things (in very primitive state)

submitted by /u/Nikko_the_Rabbit
[link] [comments]  I have a very primitive python game about a drone on a spaceship. There is a function that creates a tablet (lines 150-382), which I hoped would be the center of my information return to the ‘audience,’ but any text I blit onto the tablet flashes horribly and I can’t fix it. I am very much an amateur and was hoping someone better at code might know what is wrong. link the github: Nikko-R-M/Spaceship-Game: A drone on a ship doing little things (in very primitive state) submitted by /u/Nikko_the_Rabbit [link] [comments]

Read more

anyone’s doing Angela Yu’s 100 days python bootcamp? /u/vaibhavreads Python Education

anyone’s doing Angela Yu’s 100 days python bootcamp? /u/vaibhavreads Python Education

I am currently on day 14 and just downloaded the resource. However, the files contain gibberish instead of the expected data. Can anyone help me?

submitted by /u/vaibhavreads
[link] [comments]

​r/learnpython I am currently on day 14 and just downloaded the resource. However, the files contain gibberish instead of the expected data. Can anyone help me? submitted by /u/vaibhavreads [link] [comments] 

I am currently on day 14 and just downloaded the resource. However, the files contain gibberish instead of the expected data. Can anyone help me?

submitted by /u/vaibhavreads
[link] [comments]  I am currently on day 14 and just downloaded the resource. However, the files contain gibberish instead of the expected data. Can anyone help me? submitted by /u/vaibhavreads [link] [comments]

Read more

Search Builder /u/JuniorMouse Python Education

Search Builder /u/JuniorMouse Python Education

I’m hoping to get some help on how to implement a search where users can enter

  • boolean criteria (main focus)
  • attribute that the search term should apply to

At the very least, I would really be grateful for what I should be looking up or whether there are any libraries available that can help with this. What I have found so far are articles that suggest using NLP which I really don’t think is what I need.

As reference, on https://pmc.ncbi.nlm.nih.gov/, I can enter into the search a query like

(ozempic[Title] AND diabetes[Title]) NOT obesity[Title]

to specify that I want only articles where the title contains both the words ozempic and diabetes but not the word obesity.

Similarly, on https://github.com/paperless-ngx/paperless-ngx/issues, I can enter the search query

is:issue is:closed in:title email

to filter all issues that have the word email in the title.

Edit: The user interface maybe a web browser, GUI desktop application, CLI, etc

submitted by /u/JuniorMouse
[link] [comments]

​r/learnpython I’m hoping to get some help on how to implement a search where users can enter boolean criteria (main focus) attribute that the search term should apply to At the very least, I would really be grateful for what I should be looking up or whether there are any libraries available that can help with this. What I have found so far are articles that suggest using NLP which I really don’t think is what I need. As reference, on https://pmc.ncbi.nlm.nih.gov/, I can enter into the search a query like (ozempic[Title] AND diabetes[Title]) NOT obesity[Title] to specify that I want only articles where the title contains both the words ozempic and diabetes but not the word obesity. Similarly, on https://github.com/paperless-ngx/paperless-ngx/issues, I can enter the search query is:issue is:closed in:title email to filter all issues that have the word email in the title. Edit: The user interface maybe a web browser, GUI desktop application, CLI, etc submitted by /u/JuniorMouse [link] [comments] 

I’m hoping to get some help on how to implement a search where users can enter

  • boolean criteria (main focus)
  • attribute that the search term should apply to

At the very least, I would really be grateful for what I should be looking up or whether there are any libraries available that can help with this. What I have found so far are articles that suggest using NLP which I really don’t think is what I need.

As reference, on https://pmc.ncbi.nlm.nih.gov/, I can enter into the search a query like

(ozempic[Title] AND diabetes[Title]) NOT obesity[Title]

to specify that I want only articles where the title contains both the words ozempic and diabetes but not the word obesity.

Similarly, on https://github.com/paperless-ngx/paperless-ngx/issues, I can enter the search query

is:issue is:closed in:title email

to filter all issues that have the word email in the title.

Edit: The user interface maybe a web browser, GUI desktop application, CLI, etc

submitted by /u/JuniorMouse
[link] [comments]  I’m hoping to get some help on how to implement a search where users can enter boolean criteria (main focus) attribute that the search term should apply to At the very least, I would really be grateful for what I should be looking up or whether there are any libraries available that can help with this. What I have found so far are articles that suggest using NLP which I really don’t think is what I need. As reference, on https://pmc.ncbi.nlm.nih.gov/, I can enter into the search a query like (ozempic[Title] AND diabetes[Title]) NOT obesity[Title] to specify that I want only articles where the title contains both the words ozempic and diabetes but not the word obesity. Similarly, on https://github.com/paperless-ngx/paperless-ngx/issues, I can enter the search query is:issue is:closed in:title email to filter all issues that have the word email in the title. Edit: The user interface maybe a web browser, GUI desktop application, CLI, etc submitted by /u/JuniorMouse [link] [comments]

Read more

Wrapper functions and data validation /u/Technical_Ad9319 Python Education

Wrapper functions and data validation /u/Technical_Ad9319 Python Education

I was trying to develop my first decorator, which was a benchmark function that was supposed to wrap other functions, however it seems that decorators mess a lot with the output var type, in my case all vars types are being validated. Is this a known issue or I’m just not knowing how to properly implement wrappers?

submitted by /u/Technical_Ad9319
[link] [comments]

​r/learnpython I was trying to develop my first decorator, which was a benchmark function that was supposed to wrap other functions, however it seems that decorators mess a lot with the output var type, in my case all vars types are being validated. Is this a known issue or I’m just not knowing how to properly implement wrappers? submitted by /u/Technical_Ad9319 [link] [comments] 

I was trying to develop my first decorator, which was a benchmark function that was supposed to wrap other functions, however it seems that decorators mess a lot with the output var type, in my case all vars types are being validated. Is this a known issue or I’m just not knowing how to properly implement wrappers?

submitted by /u/Technical_Ad9319
[link] [comments]  I was trying to develop my first decorator, which was a benchmark function that was supposed to wrap other functions, however it seems that decorators mess a lot with the output var type, in my case all vars types are being validated. Is this a known issue or I’m just not knowing how to properly implement wrappers? submitted by /u/Technical_Ad9319 [link] [comments]

Read more

Confused about installing python packages on Mac /u/Xanimede Python Education

Confused about installing python packages on Mac /u/Xanimede Python Education

I cant use ‘pip3 install xx’ because I get the “externally managed environment” error. I have to create a virtual environment to use pip.

But surely this isn’t the right way to do it? There’s no way that every time I start a new project, no matter how small it is, I have to install things like pandas or numpy every single time, and end up with like 50+ installations of the same packages?

Why can’t you just install a python package on your system as you do on Windows/Linux? I’ve read some comments saying that this is the right approach to prevent conflicts, but why is this not a problem for other OS?

submitted by /u/Xanimede
[link] [comments]

​r/learnpython I cant use ‘pip3 install xx’ because I get the “externally managed environment” error. I have to create a virtual environment to use pip. But surely this isn’t the right way to do it? There’s no way that every time I start a new project, no matter how small it is, I have to install things like pandas or numpy every single time, and end up with like 50+ installations of the same packages? Why can’t you just install a python package on your system as you do on Windows/Linux? I’ve read some comments saying that this is the right approach to prevent conflicts, but why is this not a problem for other OS? submitted by /u/Xanimede [link] [comments] 

I cant use ‘pip3 install xx’ because I get the “externally managed environment” error. I have to create a virtual environment to use pip.

But surely this isn’t the right way to do it? There’s no way that every time I start a new project, no matter how small it is, I have to install things like pandas or numpy every single time, and end up with like 50+ installations of the same packages?

Why can’t you just install a python package on your system as you do on Windows/Linux? I’ve read some comments saying that this is the right approach to prevent conflicts, but why is this not a problem for other OS?

submitted by /u/Xanimede
[link] [comments]  I cant use ‘pip3 install xx’ because I get the “externally managed environment” error. I have to create a virtual environment to use pip. But surely this isn’t the right way to do it? There’s no way that every time I start a new project, no matter how small it is, I have to install things like pandas or numpy every single time, and end up with like 50+ installations of the same packages? Why can’t you just install a python package on your system as you do on Windows/Linux? I’ve read some comments saying that this is the right approach to prevent conflicts, but why is this not a problem for other OS? submitted by /u/Xanimede [link] [comments]

Read more

Why is my 21 game code not working /u/Own-Recipe5931 Python Education

Why is my 21 game code not working /u/Own-Recipe5931 Python Education

the problem to me the try and except even when i make a integer input it still runs the except block code stopping my progress

Here’s my code

import random

startup = random.randint(1,3)

print(“My number is “, startup)

check = startup + 3

nexnum = int(input(“Enter your number n- “))

def check_round():

while nexnum > check:

print(“Your number is too highn Please try again”)

nexnum = int(input(“-“))

while nexnum or startup != 21:

try:

nexnum = int(nexnum)

check_round()

except:

print(“Please enter a whole number”)

nexnum = int(input(“-“))

continue

func1 = nexnum + 3

func2 = nexnum – 1

startup = random.randint(func2, func1)

nexnum = int(input(“Enter your next numbern-“))

continue

submitted by /u/Own-Recipe5931
[link] [comments]

​r/learnpython the problem to me the try and except even when i make a integer input it still runs the except block code stopping my progress Here’s my code import random startup = random.randint(1,3) print(“My number is “, startup) check = startup + 3 nexnum = int(input(“Enter your number n- “)) def check_round(): while nexnum > check: print(“Your number is too highn Please try again”) nexnum = int(input(“-“)) while nexnum or startup != 21: try: nexnum = int(nexnum) check_round() except: print(“Please enter a whole number”) nexnum = int(input(“-“)) continue func1 = nexnum + 3 func2 = nexnum – 1 startup = random.randint(func2, func1) nexnum = int(input(“Enter your next numbern-“)) continue submitted by /u/Own-Recipe5931 [link] [comments] 

the problem to me the try and except even when i make a integer input it still runs the except block code stopping my progress

Here’s my code

import random

startup = random.randint(1,3)

print(“My number is “, startup)

check = startup + 3

nexnum = int(input(“Enter your number n- “))

def check_round():

while nexnum > check:

print(“Your number is too highn Please try again”)

nexnum = int(input(“-“))

while nexnum or startup != 21:

try:

nexnum = int(nexnum)

check_round()

except:

print(“Please enter a whole number”)

nexnum = int(input(“-“))

continue

func1 = nexnum + 3

func2 = nexnum – 1

startup = random.randint(func2, func1)

nexnum = int(input(“Enter your next numbern-“))

continue

submitted by /u/Own-Recipe5931
[link] [comments]  the problem to me the try and except even when i make a integer input it still runs the except block code stopping my progress Here’s my code import random startup = random.randint(1,3) print(“My number is “, startup) check = startup + 3 nexnum = int(input(“Enter your number n- “)) def check_round(): while nexnum > check: print(“Your number is too highn Please try again”) nexnum = int(input(“-“)) while nexnum or startup != 21: try: nexnum = int(nexnum) check_round() except: print(“Please enter a whole number”) nexnum = int(input(“-“)) continue func1 = nexnum + 3 func2 = nexnum – 1 startup = random.randint(func2, func1) nexnum = int(input(“Enter your next numbern-“)) continue submitted by /u/Own-Recipe5931 [link] [comments]

Read more

SQLAlchemy question for polymorphic reference /u/pleides101 Python Education

SQLAlchemy question for polymorphic reference /u/pleides101 Python Education

Hi. Started to learn python and am working on a small project to build a trading system. I took help from various coding AI assistants to build up the different pieces and got it to a working state. However I was using bare SQL queries for all my data management and although I tried to minimise possibilities of error and injections, it was still looking cumbersome. So I wanted to experiment with an ORM and tried sql alchemy. But due to how my table relationships are modelled Im having difficulty figuring out how to express them in a way sql alchemy can understand, none of the AI assistants have been able to help me.

Basically it is a hierarchy of Strategy -> StrategySet -> Leg. And the Strategy and Leg entities have indirect StopLoss and TrailingStopLoss relationships. I’m not using a dedicated column on the Strategy and Leg entities to reference the StopLoss and TrailingStopLoss as it wouldn’t work out. A Strategy or Leg can have multiple stop losses or Trailing Stop losses defined and hence it would be a one to many relationship. So I modelled the StopLoss and TrailingStopLoss to hold a polymorphic reference called entity type. Depending on the entity type(Strategy or Leg) the entity id could hold reference to a Strategy or Leg id. So now whenever a new StopLoss or TrailingStopLoss is to be created I want to ensure the entity type is validated to be Strategy or Leg and then ensure the corresponding entity id actually exists in Strategy or Leg. I was able to do all of this manually when I wrote the SQL queries myself but now having trouble modelling all of this in SQL alchemy. Any help or advice on what to do? Should I just create dedicated StopLoss and TrailingStopLoss entities for Strategy and Leg separately? I wanted to keep redundant columns or tables to a minimum.

Here’s the complete code(not working) for more details in case you need it – https://gist.github.com/karthik448/cd5bafb8e4cd5e37d5dfdffe26643d76

The only working code that any of the AIs could do was to add in a stop loss and trailing stop loss reference id into the strategy and leg entities and use the relationship and back-populates to add it in when a stop loss entry is created. This is obviously not going to work out for me as I want to have one to many relationship here.

submitted by /u/pleides101
[link] [comments]

​r/learnpython Hi. Started to learn python and am working on a small project to build a trading system. I took help from various coding AI assistants to build up the different pieces and got it to a working state. However I was using bare SQL queries for all my data management and although I tried to minimise possibilities of error and injections, it was still looking cumbersome. So I wanted to experiment with an ORM and tried sql alchemy. But due to how my table relationships are modelled Im having difficulty figuring out how to express them in a way sql alchemy can understand, none of the AI assistants have been able to help me. Basically it is a hierarchy of Strategy -> StrategySet -> Leg. And the Strategy and Leg entities have indirect StopLoss and TrailingStopLoss relationships. I’m not using a dedicated column on the Strategy and Leg entities to reference the StopLoss and TrailingStopLoss as it wouldn’t work out. A Strategy or Leg can have multiple stop losses or Trailing Stop losses defined and hence it would be a one to many relationship. So I modelled the StopLoss and TrailingStopLoss to hold a polymorphic reference called entity type. Depending on the entity type(Strategy or Leg) the entity id could hold reference to a Strategy or Leg id. So now whenever a new StopLoss or TrailingStopLoss is to be created I want to ensure the entity type is validated to be Strategy or Leg and then ensure the corresponding entity id actually exists in Strategy or Leg. I was able to do all of this manually when I wrote the SQL queries myself but now having trouble modelling all of this in SQL alchemy. Any help or advice on what to do? Should I just create dedicated StopLoss and TrailingStopLoss entities for Strategy and Leg separately? I wanted to keep redundant columns or tables to a minimum. Here’s the complete code(not working) for more details in case you need it – https://gist.github.com/karthik448/cd5bafb8e4cd5e37d5dfdffe26643d76 The only working code that any of the AIs could do was to add in a stop loss and trailing stop loss reference id into the strategy and leg entities and use the relationship and back-populates to add it in when a stop loss entry is created. This is obviously not going to work out for me as I want to have one to many relationship here. submitted by /u/pleides101 [link] [comments] 

Hi. Started to learn python and am working on a small project to build a trading system. I took help from various coding AI assistants to build up the different pieces and got it to a working state. However I was using bare SQL queries for all my data management and although I tried to minimise possibilities of error and injections, it was still looking cumbersome. So I wanted to experiment with an ORM and tried sql alchemy. But due to how my table relationships are modelled Im having difficulty figuring out how to express them in a way sql alchemy can understand, none of the AI assistants have been able to help me.

Basically it is a hierarchy of Strategy -> StrategySet -> Leg. And the Strategy and Leg entities have indirect StopLoss and TrailingStopLoss relationships. I’m not using a dedicated column on the Strategy and Leg entities to reference the StopLoss and TrailingStopLoss as it wouldn’t work out. A Strategy or Leg can have multiple stop losses or Trailing Stop losses defined and hence it would be a one to many relationship. So I modelled the StopLoss and TrailingStopLoss to hold a polymorphic reference called entity type. Depending on the entity type(Strategy or Leg) the entity id could hold reference to a Strategy or Leg id. So now whenever a new StopLoss or TrailingStopLoss is to be created I want to ensure the entity type is validated to be Strategy or Leg and then ensure the corresponding entity id actually exists in Strategy or Leg. I was able to do all of this manually when I wrote the SQL queries myself but now having trouble modelling all of this in SQL alchemy. Any help or advice on what to do? Should I just create dedicated StopLoss and TrailingStopLoss entities for Strategy and Leg separately? I wanted to keep redundant columns or tables to a minimum.

Here’s the complete code(not working) for more details in case you need it – https://gist.github.com/karthik448/cd5bafb8e4cd5e37d5dfdffe26643d76

The only working code that any of the AIs could do was to add in a stop loss and trailing stop loss reference id into the strategy and leg entities and use the relationship and back-populates to add it in when a stop loss entry is created. This is obviously not going to work out for me as I want to have one to many relationship here.

submitted by /u/pleides101
[link] [comments]  Hi. Started to learn python and am working on a small project to build a trading system. I took help from various coding AI assistants to build up the different pieces and got it to a working state. However I was using bare SQL queries for all my data management and although I tried to minimise possibilities of error and injections, it was still looking cumbersome. So I wanted to experiment with an ORM and tried sql alchemy. But due to how my table relationships are modelled Im having difficulty figuring out how to express them in a way sql alchemy can understand, none of the AI assistants have been able to help me. Basically it is a hierarchy of Strategy -> StrategySet -> Leg. And the Strategy and Leg entities have indirect StopLoss and TrailingStopLoss relationships. I’m not using a dedicated column on the Strategy and Leg entities to reference the StopLoss and TrailingStopLoss as it wouldn’t work out. A Strategy or Leg can have multiple stop losses or Trailing Stop losses defined and hence it would be a one to many relationship. So I modelled the StopLoss and TrailingStopLoss to hold a polymorphic reference called entity type. Depending on the entity type(Strategy or Leg) the entity id could hold reference to a Strategy or Leg id. So now whenever a new StopLoss or TrailingStopLoss is to be created I want to ensure the entity type is validated to be Strategy or Leg and then ensure the corresponding entity id actually exists in Strategy or Leg. I was able to do all of this manually when I wrote the SQL queries myself but now having trouble modelling all of this in SQL alchemy. Any help or advice on what to do? Should I just create dedicated StopLoss and TrailingStopLoss entities for Strategy and Leg separately? I wanted to keep redundant columns or tables to a minimum. Here’s the complete code(not working) for more details in case you need it – https://gist.github.com/karthik448/cd5bafb8e4cd5e37d5dfdffe26643d76 The only working code that any of the AIs could do was to add in a stop loss and trailing stop loss reference id into the strategy and leg entities and use the relationship and back-populates to add it in when a stop loss entry is created. This is obviously not going to work out for me as I want to have one to many relationship here. submitted by /u/pleides101 [link] [comments]

Read more

need help with basics /u/ah_ahaa Python Education

need help with basics /u/ah_ahaa Python Education

hey , started to learn python i am a complete beginner in code writing) and right now im on “if” , “else”,”elife”, part

i practice on all the basics and i came across an issue with this part

num1 = int(input("what is your lucky nubmer? ")) num2 = int(input("what is your age? ")) num3 = num1+num2 ques1 = int(input("please enter a number above " +num3 , )) 

in “ques1” i want the user to be asked to put number above “num3” so from there i can keep add more stuff just to mess around and test myself. issue is , no matter where i tried to put “num3” in the “ques” input i get error.
where should i put it?
thanks!

submitted by /u/ah_ahaa
[link] [comments]

​r/learnpython hey , started to learn python i am a complete beginner in code writing) and right now im on “if” , “else”,”elife”, part i practice on all the basics and i came across an issue with this part num1 = int(input(“what is your lucky nubmer? “)) num2 = int(input(“what is your age? “)) num3 = num1+num2 ques1 = int(input(“please enter a number above ” +num3 , )) in “ques1” i want the user to be asked to put number above “num3” so from there i can keep add more stuff just to mess around and test myself. issue is , no matter where i tried to put “num3” in the “ques” input i get error. where should i put it? thanks! submitted by /u/ah_ahaa [link] [comments] 

hey , started to learn python i am a complete beginner in code writing) and right now im on “if” , “else”,”elife”, part

i practice on all the basics and i came across an issue with this part

num1 = int(input("what is your lucky nubmer? ")) num2 = int(input("what is your age? ")) num3 = num1+num2 ques1 = int(input("please enter a number above " +num3 , )) 

in “ques1” i want the user to be asked to put number above “num3” so from there i can keep add more stuff just to mess around and test myself. issue is , no matter where i tried to put “num3” in the “ques” input i get error.
where should i put it?
thanks!

submitted by /u/ah_ahaa
[link] [comments]  hey , started to learn python i am a complete beginner in code writing) and right now im on “if” , “else”,”elife”, part i practice on all the basics and i came across an issue with this part num1 = int(input(“what is your lucky nubmer? “)) num2 = int(input(“what is your age? “)) num3 = num1+num2 ques1 = int(input(“please enter a number above ” +num3 , )) in “ques1” i want the user to be asked to put number above “num3” so from there i can keep add more stuff just to mess around and test myself. issue is , no matter where i tried to put “num3” in the “ques” input i get error. where should i put it? thanks! submitted by /u/ah_ahaa [link] [comments]

Read more