Re: error in python
Re: error in python @4, I completely missed that, apologies. URL: https://forum.audiogames.net/post/432924/#p432924 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: error in python
Re: error in python @ethin that code is wrong. You use if i == 5, however i isn't declared anywhere and you should use count for that. Also you increment count after the if condition with the continue, so it will loop forever when count is 5 because count never increases. Your loop will also count 11, because when count is 10 it still triggers the loop.You could code it like thiscount = 0while count < 10: # Do this to avoid it printing 11 count += 1 if count == 5: continue print(count)input("Press enter to exit") URL: https://forum.audiogames.net/post/432905/#p432905 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: error in python
Re: error in python I'd advise using a for loop here. While loops are really meant for iterating an indefinite number of times, which is usually good for things like input validation. If you know the number of times you want code to run, use a for loop.I strongly advise this if you are new to programming. It's easy to get stuck in an infinite loop when using the while structure. It's important that you understand the difference between the different types of loops earlier on in your understanding of programming concepts. Your code would look more like this:for count in range(1, 11): if count == 5: continue print(count) input("Press enter to exit")This block of codeGuarantees the number of times the code iteratesEliminates the need for a counter variableEliminates the need to break from the loopShortens the amount of code to accomplish the thing you want to do URL: https://forum.audiogames.net/post/432892/#p432892 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: error in python
Re: error in python @2, can't we just write the loop like this?for i in range(11): if i==5: continue print(i) URL: https://forum.audiogames.net/post/432272/#p432272 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: error in python
Re: error in python You must capitalize true and false, as well as other constants. (In other libraries and, indeed, in Pythons standard library, many constants are all uppercase; but in the world of Python, true and false are capitalized, not all uppercase.) Remember that Python is not case insensitive, meaning that true and True are entirely different variables. If you wish to use Python, you must learn to determine what case something is written in, else you won't get very far. Also, your loop can be easily rewritten to take up a few less lines:count = 0 while count < 11: # not 10, because we're counting from zero, which is mathematically correct (there are debates on this subject) if i == 5: continue count += 1 print (count) input("Press enter to exit") URL: https://forum.audiogames.net/post/432134/#p432134 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: error in python
Re: error in python You must capitalize true and false, as well as other constants. (In other libraries and, indeed, in Pythons standard library, many constants are all uppercase; but in the world of Python, true and false are capitalized, not all uppercase.) Remember that Python is not case insensitive, meaning that true and True are entirely different variables. If you wish to use Python, you must learn to determine what case something is written in, else you won't get very far. URL: https://forum.audiogames.net/post/432134/#p432134 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
error in python
error in python Hi everyone I am a beginner in python.I am trying to code a simple script which counts 1 to 10 leaving 5 but i am getting this error:>>> count = 0 >>> while true: ... count += 1 ... if count > 10: ... break ... if count == 5: ... continue ... print(count) Traceback (most recent call last): File "", line 1, in NameError: name 'true' is not defined >>> input("\nPress the enter key to exit.") Press the enter key to exit.I have take example of other code as well it works fine but the code that i typed does not work fine.why it is happeningi am using edsharp to type these code.i am using python 3.7.2in windows 10 with nvda below i have posted my own code and the code from which i took referencemy own code::count = 0while true: count += 1 if count > 10: break if count == 5: continue print(count)input("\nPress the enter key to exit.")reference code::count = 0while True: count += 1 if count > 10: break if count == 5: continue print(count)input("\n\nPress the enter key to exit.")please help. due to these errors i am not being able to learn. python URL: https://forum.audiogames.net/post/432124/#p432124 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
error in python
error in python Hi everyone I am a beginner in python.I am trying to code a simple script which counts 1 to 10 leaving 5 but i am getting this error:>>> count = 0 >>> while true: ... count += 1 ... if count > 10: ... break ... if count == 5: ... continue ... print(count) Traceback (most recent call last): File "", line 1, in NameError: name 'true' is not defined >>> input("\nPress the enter key to exit.") File "", line 1 input("\nPress the enter key to exit.") ^ IndentationError: unexpected indent I have take example of other code as well it works fine but the code that typed doesnot work fine.why it is happeningi am using edsharp to type these code.i am using python 3.7.2in windows 10 with nvda below i have posted my own code and the code from which i took referencemy own code::count = 0while true: count += 1 if count > 10: break if count == 5: continue print(count) input("\nPress the enter key to exit.")reference code::count = 0while True: count += 1 if count > 10: break if count == 5: continue print(count)input("\n\nPress the enter key to exit.")please help due to these errors i am not being able to learn. URL: https://forum.audiogames.net/post/432124/#p432124 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Error with python using pip
Re: Error with python using pip Hmm, this looks like a known unicode issue cropping up involving a path to a target package on your system, you can read a bit about it [here]. There are a few suggested solutions in that thread, but installing your desired packages manually as others have suggested may be less trouble. URL: http://forum.audiogames.net/viewtopic.php?pid=283670#p283670 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Error with python using pip
Re: Error with python using pip i'd also make sure your pip and all that stuff is up to date URL: http://forum.audiogames.net/viewtopic.php?pid=283622#p283622 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Error with python using pip
Re: Error with python using pip Maybe Pip can't find the place to download the packages, so you'll need to download them manually.Pygame can be found at:http://pygame.org/ftp/pygame-1.9.1.win32-py2.7.msiWxPython can be found at:http://downloads.sourceforge.net/wxpyth … 0-py27.exe URL: http://forum.audiogames.net/viewtopic.php?pid=283619#p283619 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Error with python using pip
Error with python using pip Hi,I'm trying to install pygame and wx but i can't do it. I get the next error: Can someone help me? I'm using windows 10 of 64 bits.C:\Users\jesus>pip install pygameCollecting pygameException:Traceback (most recent call last): File "c:\python27\lib\site-packages\pip\basecommand.py", line 209, in main status = self.run(options, args) File "c:\python27\lib\site-packages\pip\commands\install.py", line 299, in run requirement_set.prepare_files(finder) File "c:\python27\lib\site-packages\pip\req\req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "c:\python27\lib\site-packages\pip\req\req_set.py", line 512, in _prepare_file finder, self.upgrade, require_hashes) File "c:\python27\lib\site-packages\pip\req\req_install.py uot;, line 273, in populate_link self.link = finder.find_requirement(self, upgrade) File "c:\python27\lib\site-packages\pip\index.py", line 440, in find_requirement all_candidates = self.find_all_candidates(req.name) File "c:\python27\lib\site-packages\pip\index.py", line 398, in find_all_candidates for page in self._get_pages(url_locations, project_name): File "c:\python27\lib\site-packages\pip\index.py", line 543, in _get_pages page = self._get_page(location) File "c:\python27\lib\site-packages\pip\index.py", line 646, in _get_page return HTMLPage.get_page(link, session=self.session) File "c:\python27\lib\site-packages\pip\index.py", line 755, in get_page "Cache-Control": "max-age=600", File "c:\python27\lib\site-packages\pi p\_vendor\requests\sessions.py", line 480, in get return self.request('GET', url, **kwargs) File "c:\python27\lib\site-packages\pip\download.py", line 378, in request return super(PipSession, self).request(method, url, *args, **kwargs) File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 468, in request resp = self.send(prep, **send_kwargs) File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 608, in send r.content File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line 737, in content self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes() File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line 660, in generate for chunk in self.raw.stream(chun k_size, decode_content=True): File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 344, in stream data = "" decode_content=decode_content) File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 301, in read data = "" /> File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read self.__callback(self.__buf.getvalue()) File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 297, in cache_response self.serializer.dumps(request, response, body=body), File "c:\python27\lib\site-packages\pip\download.py", line 281, in set return super(SafeFileCache, self).set(*args, **kwargs) File "c:\python27\lib\site-pac kages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set with self.lock_class(name) as lock: File "c:\python27\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 19, in __init__ LockBase.__init__(self, path, threaded, timeout) File "c:\python27\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 242, in __init__ hash(self.path))) File "c:\python27\lib\ntpath.py", line 85, in join result_path = result_path + p_pathUnicodeDecodeError: 'ascii' codec can't decode byte 0xfa in position 3: ordinal not in range(128)Sorry for my bad english, is not my native language. URL: http://forum.audiogames.net/viewtopic.php?pid=283602#p283602 ___ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector