Matplotlib not working /u/WatercressGood4334 Python Education

Matplotlib not working /u/WatercressGood4334 Python Education

I downloaded Matplotlib and I can run command

import matplotlib as plt 

without any problem, however using any other command doesn’t work and I get en error. For example I obtain error: “AttributeError: module ‘matplotlib’ has no attribute ‘plot'” for command:

print(plt.plot([1,2,3],[2,4,6])) 

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

​r/learnpython I downloaded Matplotlib and I can run command import matplotlib as plt without any problem, however using any other command doesn’t work and I get en error. For example I obtain error: “AttributeError: module ‘matplotlib’ has no attribute ‘plot'” for command: print(plt.plot([1,2,3],[2,4,6])) submitted by /u/WatercressGood4334 [link] [comments] 

I downloaded Matplotlib and I can run command

import matplotlib as plt 

without any problem, however using any other command doesn’t work and I get en error. For example I obtain error: “AttributeError: module ‘matplotlib’ has no attribute ‘plot'” for command:

print(plt.plot([1,2,3],[2,4,6])) 

submitted by /u/WatercressGood4334
[link] [comments]  I downloaded Matplotlib and I can run command import matplotlib as plt without any problem, however using any other command doesn’t work and I get en error. For example I obtain error: “AttributeError: module ‘matplotlib’ has no attribute ‘plot'” for command: print(plt.plot([1,2,3],[2,4,6])) submitted by /u/WatercressGood4334 [link] [comments]

Read more

How to create list with any instances of generic /u/gerska_ Python Education

How to create list with any instances of generic /u/gerska_ Python Education

I want to create a list with any ServiceManager (within generic bounds).

First I tried using the base type in my list, but I get errors with invariance.

Then I tried using Any, but it made the type system too lax, and no longer catching errors.

Do you have any suggestions?

Thanks in advance 😄

Example:

from dataclasses import dataclass from typing import Any # service definition @dataclass class ServiceState: pass class Service[SS: ServiceState]: def __init__(self, state: SS): self.state = state def get_state(self) -> SS: return self.state # create services @dataclass class PizzaServiceState(ServiceState): topping: str sauce: str class PizzaService(Service[PizzaServiceState]): def __init__(self, state: PizzaServiceState): super().__init__(state) @dataclass class IceCreamServiceState(ServiceState): flavor: str topping: str class IceCreamService(Service[IceCreamServiceState]): def __init__(self, state: IceCreamServiceState): super().__init__(state) # service manager class ServiceManager[SS: ServiceState]: def __init__(self, service: type[Service[SS]], state: SS): self.service = service(state) def get_state(self) -> SS: return self.service.get_state() # usage service_list: list[ServiceManager[ServiceState]] = [] service_list.append( ServiceManager(PizzaService, PizzaServiceState(topping='cheese', sauce='tomato')) ) # Pyright error: Type parameter "SS@ServiceManager" is invariant, but "PizzaServiceState" is not the same as "ServiceState" service_list_any: list[ServiceManager[Any]] = [] service_list_any.append( ServiceManager(PizzaService, PizzaServiceState(topping='cheese', sauce='tomato')) ) # this is fine service_list_any.append( ServiceManager(IceCreamService, int) ) # this is fine, but should not be allowed 

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

​r/learnpython I want to create a list with any ServiceManager (within generic bounds). First I tried using the base type in my list, but I get errors with invariance. Then I tried using Any, but it made the type system too lax, and no longer catching errors. Do you have any suggestions? Thanks in advance 😄 Example: from dataclasses import dataclass from typing import Any # service definition @dataclass class ServiceState: pass class Service[SS: ServiceState]: def __init__(self, state: SS): self.state = state def get_state(self) -> SS: return self.state # create services @dataclass class PizzaServiceState(ServiceState): topping: str sauce: str class PizzaService(Service[PizzaServiceState]): def __init__(self, state: PizzaServiceState): super().__init__(state) @dataclass class IceCreamServiceState(ServiceState): flavor: str topping: str class IceCreamService(Service[IceCreamServiceState]): def __init__(self, state: IceCreamServiceState): super().__init__(state) # service manager class ServiceManager[SS: ServiceState]: def __init__(self, service: type[Service[SS]], state: SS): self.service = service(state) def get_state(self) -> SS: return self.service.get_state() # usage service_list: list[ServiceManager[ServiceState]] = [] service_list.append( ServiceManager(PizzaService, PizzaServiceState(topping=’cheese’, sauce=’tomato’)) ) # Pyright error: Type parameter “SS@ServiceManager” is invariant, but “PizzaServiceState” is not the same as “ServiceState” service_list_any: list[ServiceManager[Any]] = [] service_list_any.append( ServiceManager(PizzaService, PizzaServiceState(topping=’cheese’, sauce=’tomato’)) ) # this is fine service_list_any.append( ServiceManager(IceCreamService, int) ) # this is fine, but should not be allowed submitted by /u/gerska_ [link] [comments] 

I want to create a list with any ServiceManager (within generic bounds).

First I tried using the base type in my list, but I get errors with invariance.

Then I tried using Any, but it made the type system too lax, and no longer catching errors.

Do you have any suggestions?

Thanks in advance 😄

Example:

from dataclasses import dataclass from typing import Any # service definition @dataclass class ServiceState: pass class Service[SS: ServiceState]: def __init__(self, state: SS): self.state = state def get_state(self) -> SS: return self.state # create services @dataclass class PizzaServiceState(ServiceState): topping: str sauce: str class PizzaService(Service[PizzaServiceState]): def __init__(self, state: PizzaServiceState): super().__init__(state) @dataclass class IceCreamServiceState(ServiceState): flavor: str topping: str class IceCreamService(Service[IceCreamServiceState]): def __init__(self, state: IceCreamServiceState): super().__init__(state) # service manager class ServiceManager[SS: ServiceState]: def __init__(self, service: type[Service[SS]], state: SS): self.service = service(state) def get_state(self) -> SS: return self.service.get_state() # usage service_list: list[ServiceManager[ServiceState]] = [] service_list.append( ServiceManager(PizzaService, PizzaServiceState(topping='cheese', sauce='tomato')) ) # Pyright error: Type parameter "SS@ServiceManager" is invariant, but "PizzaServiceState" is not the same as "ServiceState" service_list_any: list[ServiceManager[Any]] = [] service_list_any.append( ServiceManager(PizzaService, PizzaServiceState(topping='cheese', sauce='tomato')) ) # this is fine service_list_any.append( ServiceManager(IceCreamService, int) ) # this is fine, but should not be allowed 

submitted by /u/gerska_
[link] [comments]  I want to create a list with any ServiceManager (within generic bounds). First I tried using the base type in my list, but I get errors with invariance. Then I tried using Any, but it made the type system too lax, and no longer catching errors. Do you have any suggestions? Thanks in advance 😄 Example: from dataclasses import dataclass from typing import Any # service definition @dataclass class ServiceState: pass class Service[SS: ServiceState]: def __init__(self, state: SS): self.state = state def get_state(self) -> SS: return self.state # create services @dataclass class PizzaServiceState(ServiceState): topping: str sauce: str class PizzaService(Service[PizzaServiceState]): def __init__(self, state: PizzaServiceState): super().__init__(state) @dataclass class IceCreamServiceState(ServiceState): flavor: str topping: str class IceCreamService(Service[IceCreamServiceState]): def __init__(self, state: IceCreamServiceState): super().__init__(state) # service manager class ServiceManager[SS: ServiceState]: def __init__(self, service: type[Service[SS]], state: SS): self.service = service(state) def get_state(self) -> SS: return self.service.get_state() # usage service_list: list[ServiceManager[ServiceState]] = [] service_list.append( ServiceManager(PizzaService, PizzaServiceState(topping=’cheese’, sauce=’tomato’)) ) # Pyright error: Type parameter “SS@ServiceManager” is invariant, but “PizzaServiceState” is not the same as “ServiceState” service_list_any: list[ServiceManager[Any]] = [] service_list_any.append( ServiceManager(PizzaService, PizzaServiceState(topping=’cheese’, sauce=’tomato’)) ) # this is fine service_list_any.append( ServiceManager(IceCreamService, int) ) # this is fine, but should not be allowed submitted by /u/gerska_ [link] [comments]

Read more

How to switch from German to English language in Spyder? /u/TicTec_MathLover Python Education

How to switch from German to English language in Spyder? /u/TicTec_MathLover Python Education

Hi Guys;
after I looked how to switch the language setting on my Spyder and trying to switch the language in the Werkzeuge-> Einstellungen, I did not see anywhere where I can change the language. I checked some previous post similar, but I do not find the weitere Einstellungen!!.

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

​r/learnpython Hi Guys; after I looked how to switch the language setting on my Spyder and trying to switch the language in the Werkzeuge-> Einstellungen, I did not see anywhere where I can change the language. I checked some previous post similar, but I do not find the weitere Einstellungen!!. submitted by /u/TicTec_MathLover [link] [comments] 

Hi Guys;
after I looked how to switch the language setting on my Spyder and trying to switch the language in the Werkzeuge-> Einstellungen, I did not see anywhere where I can change the language. I checked some previous post similar, but I do not find the weitere Einstellungen!!.

submitted by /u/TicTec_MathLover
[link] [comments]  Hi Guys; after I looked how to switch the language setting on my Spyder and trying to switch the language in the Werkzeuge-> Einstellungen, I did not see anywhere where I can change the language. I checked some previous post similar, but I do not find the weitere Einstellungen!!. submitted by /u/TicTec_MathLover [link] [comments]

Read more

Real world examples of projects /u/RockPaperOctopus Python Education

Real world examples of projects /u/RockPaperOctopus Python Education

Hi folks, this is perhaps a stupid question, I’m not sure, but I was wondering if there are any examples of real world problems/projects that I could look at. Things which a beginner developer might face in the day to day. I’ve been trying to beat my head against coding specifically python for a while now but being taught the likes of how to flip a coin 10 times and create a madlibs generator isn’t really cutting it in terms of being able to know how to actually apply coding or utilise it in the real world. There seems to be an intuitive step which I can’t grasp without real world examples and the various tutorials aren’t really that helpful in terms of making that jump

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

​r/learnpython Hi folks, this is perhaps a stupid question, I’m not sure, but I was wondering if there are any examples of real world problems/projects that I could look at. Things which a beginner developer might face in the day to day. I’ve been trying to beat my head against coding specifically python for a while now but being taught the likes of how to flip a coin 10 times and create a madlibs generator isn’t really cutting it in terms of being able to know how to actually apply coding or utilise it in the real world. There seems to be an intuitive step which I can’t grasp without real world examples and the various tutorials aren’t really that helpful in terms of making that jump submitted by /u/RockPaperOctopus [link] [comments] 

Hi folks, this is perhaps a stupid question, I’m not sure, but I was wondering if there are any examples of real world problems/projects that I could look at. Things which a beginner developer might face in the day to day. I’ve been trying to beat my head against coding specifically python for a while now but being taught the likes of how to flip a coin 10 times and create a madlibs generator isn’t really cutting it in terms of being able to know how to actually apply coding or utilise it in the real world. There seems to be an intuitive step which I can’t grasp without real world examples and the various tutorials aren’t really that helpful in terms of making that jump

submitted by /u/RockPaperOctopus
[link] [comments]  Hi folks, this is perhaps a stupid question, I’m not sure, but I was wondering if there are any examples of real world problems/projects that I could look at. Things which a beginner developer might face in the day to day. I’ve been trying to beat my head against coding specifically python for a while now but being taught the likes of how to flip a coin 10 times and create a madlibs generator isn’t really cutting it in terms of being able to know how to actually apply coding or utilise it in the real world. There seems to be an intuitive step which I can’t grasp without real world examples and the various tutorials aren’t really that helpful in terms of making that jump submitted by /u/RockPaperOctopus [link] [comments]

Read more

Having a hard time with cron-job.org API /u/LionHeart_soul Python Education

Having a hard time with cron-job.org API /u/LionHeart_soul Python Education

I want to create a cron job on cron-job.org through their API using python.

As a result, I get 404.

I don’t know exactly what is not found

Here’s full code:

from datetime import datetime import requests, json # Cron-job.org API URL api_url = "https://cron-job.org/api/1.0/user/cronjobs" # api_url = "https://api.cron-job.org" # Your cron-job.org API key api_key = "*******************************************" # Cron job details command_url = f"https://httpbin.org/json" # Extract hour and minute try: hour = 10 minute = 30 # Prepare cron job schedule (cron-job.org takes time in hour and minute, not the standard cron format) schedule = { "minute": minute, "hour": hour, "mdays": ["*"], # Every day of the month "months": ["*"], # Every month "wdays": ["*"], # Every day of the week "enabled": True, "url": command_url } # Create headers with API key for authentication headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json"} # Make the API request to create the cron job response = requests.post(api_url, headers=headers, data=json.dumps( schedule)) # Check if the cron job was created successfully if response.status_code == 201: print("Cron job created successfully.") else: print(f"Failed to create cron job: {response}") print(response.text) except Exception as e: print(f'Errrrrrror: {e}') 

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

​r/learnpython I want to create a cron job on cron-job.org through their API using python. As a result, I get 404. I don’t know exactly what is not found Here’s full code: from datetime import datetime import requests, json # Cron-job.org API URL api_url = “https://cron-job.org/api/1.0/user/cronjobs” # api_url = “https://api.cron-job.org” # Your cron-job.org API key api_key = “*******************************************” # Cron job details command_url = f”https://httpbin.org/json” # Extract hour and minute try: hour = 10 minute = 30 # Prepare cron job schedule (cron-job.org takes time in hour and minute, not the standard cron format) schedule = { “minute”: minute, “hour”: hour, “mdays”: [“*”], # Every day of the month “months”: [“*”], # Every month “wdays”: [“*”], # Every day of the week “enabled”: True, “url”: command_url } # Create headers with API key for authentication headers = { “Authorization”: f”Bearer {api_key}”, “Content-Type”: “application/json”} # Make the API request to create the cron job response = requests.post(api_url, headers=headers, data=json.dumps( schedule)) # Check if the cron job was created successfully if response.status_code == 201: print(“Cron job created successfully.”) else: print(f”Failed to create cron job: {response}”) print(response.text) except Exception as e: print(f’Errrrrrror: {e}’) submitted by /u/LionHeart_soul [link] [comments] 

I want to create a cron job on cron-job.org through their API using python.

As a result, I get 404.

I don’t know exactly what is not found

Here’s full code:

from datetime import datetime import requests, json # Cron-job.org API URL api_url = "https://cron-job.org/api/1.0/user/cronjobs" # api_url = "https://api.cron-job.org" # Your cron-job.org API key api_key = "*******************************************" # Cron job details command_url = f"https://httpbin.org/json" # Extract hour and minute try: hour = 10 minute = 30 # Prepare cron job schedule (cron-job.org takes time in hour and minute, not the standard cron format) schedule = { "minute": minute, "hour": hour, "mdays": ["*"], # Every day of the month "months": ["*"], # Every month "wdays": ["*"], # Every day of the week "enabled": True, "url": command_url } # Create headers with API key for authentication headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json"} # Make the API request to create the cron job response = requests.post(api_url, headers=headers, data=json.dumps( schedule)) # Check if the cron job was created successfully if response.status_code == 201: print("Cron job created successfully.") else: print(f"Failed to create cron job: {response}") print(response.text) except Exception as e: print(f'Errrrrrror: {e}') 

submitted by /u/LionHeart_soul
[link] [comments]  I want to create a cron job on cron-job.org through their API using python. As a result, I get 404. I don’t know exactly what is not found Here’s full code: from datetime import datetime import requests, json # Cron-job.org API URL api_url = “https://cron-job.org/api/1.0/user/cronjobs” # api_url = “https://api.cron-job.org” # Your cron-job.org API key api_key = “*******************************************” # Cron job details command_url = f”https://httpbin.org/json” # Extract hour and minute try: hour = 10 minute = 30 # Prepare cron job schedule (cron-job.org takes time in hour and minute, not the standard cron format) schedule = { “minute”: minute, “hour”: hour, “mdays”: [“*”], # Every day of the month “months”: [“*”], # Every month “wdays”: [“*”], # Every day of the week “enabled”: True, “url”: command_url } # Create headers with API key for authentication headers = { “Authorization”: f”Bearer {api_key}”, “Content-Type”: “application/json”} # Make the API request to create the cron job response = requests.post(api_url, headers=headers, data=json.dumps( schedule)) # Check if the cron job was created successfully if response.status_code == 201: print(“Cron job created successfully.”) else: print(f”Failed to create cron job: {response}”) print(response.text) except Exception as e: print(f’Errrrrrror: {e}’) submitted by /u/LionHeart_soul [link] [comments]

Read more

Looking for people to learn programming/python with /u/Teranmix Python Education

Looking for people to learn programming/python with /u/Teranmix Python Education

Ik some python and want to have some friends work on programming problems and projects .Dm me if ur interested.

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

​r/learnpython Ik some python and want to have some friends work on programming problems and projects .Dm me if ur interested. submitted by /u/Teranmix [link] [comments] 

Ik some python and want to have some friends work on programming problems and projects .Dm me if ur interested.

submitted by /u/Teranmix
[link] [comments]  Ik some python and want to have some friends work on programming problems and projects .Dm me if ur interested. submitted by /u/Teranmix [link] [comments]

Read more

Which is th best resource to learn python programming? /u/AdTemporary6204 Python Education

Which is th best resource to learn python programming? /u/AdTemporary6204 Python Education

I have figured out 3 resources, 1.Corey Schafer’s python tutorials playlist. 2.Telusko(Navin Reddy) Python for Beginners playlist. 3.Python Programming by Mooc.fi.

Out of these 3 which is the most effective one for thorough and enough understanding of python?

Those who have learned python from the above sources, please share your experience.

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

​r/learnpython I have figured out 3 resources, 1.Corey Schafer’s python tutorials playlist. 2.Telusko(Navin Reddy) Python for Beginners playlist. 3.Python Programming by Mooc.fi. Out of these 3 which is the most effective one for thorough and enough understanding of python? Those who have learned python from the above sources, please share your experience. submitted by /u/AdTemporary6204 [link] [comments] 

I have figured out 3 resources, 1.Corey Schafer’s python tutorials playlist. 2.Telusko(Navin Reddy) Python for Beginners playlist. 3.Python Programming by Mooc.fi.

Out of these 3 which is the most effective one for thorough and enough understanding of python?

Those who have learned python from the above sources, please share your experience.

submitted by /u/AdTemporary6204
[link] [comments]  I have figured out 3 resources, 1.Corey Schafer’s python tutorials playlist. 2.Telusko(Navin Reddy) Python for Beginners playlist. 3.Python Programming by Mooc.fi. Out of these 3 which is the most effective one for thorough and enough understanding of python? Those who have learned python from the above sources, please share your experience. submitted by /u/AdTemporary6204 [link] [comments]

Read more

binary data to string /u/Right-Key-4310 Python Education

binary data to string /u/Right-Key-4310 Python Education

Hi how can i convert a binary data (read from any file) to a string which contains the exact same binary data so that i can manipulate it

submitted by /u/Right-Key-4310
[link] [comments]

​r/learnpython Hi how can i convert a binary data (read from any file) to a string which contains the exact same binary data so that i can manipulate it submitted by /u/Right-Key-4310 [link] [comments] 

Hi how can i convert a binary data (read from any file) to a string which contains the exact same binary data so that i can manipulate it

submitted by /u/Right-Key-4310
[link] [comments]  Hi how can i convert a binary data (read from any file) to a string which contains the exact same binary data so that i can manipulate it submitted by /u/Right-Key-4310 [link] [comments]

Read more