Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: math problem for experts
Post: RE: math problem for experts

I had trouble making this an attachment, so here is the Linux code: #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { double c = cos((90.0/360.0) * (2.0 * ...
miltmobley General Coding Help 5 1,021 Jul-09-2023, 12:50 AM
    Thread: math problem for experts
Post: math problem for experts

While testing python code to rotate 3d points, I tried: cos_ = np.cos((90.0/360.0) * (2.0*np.pi)) cos(90) was reported as 6.123234e-17, instead of correct value of zero. tried both math.pi an...
miltmobley General Coding Help 5 1,021 Jul-08-2023, 08:24 PM
    Thread: Dictionary using variables as a keys
Post: RE: Dictionary using variables as a keys

The solution above uses a dict, but does not sort on the values. You can say: >>> a=[1,2,3] >>> b=[6,5,4] >>> c=zip(a,b) >>> c [(1, 6), (2, 5), (3, 4)] >>>...
miltmobley General Coding Help 4 3,895 Oct-09-2017, 10:33 PM
    Thread: Import problems
Post: RE: Import problems

You have to use pip3 to install in python3 site-packages
miltmobley General Coding Help 2 3,067 Oct-09-2017, 10:05 PM
    Thread: convert list compression to for loop
Post: RE: convert list compression to for loop

This reply speaks to your understanding of list comprehensions, so that you might understand the code, and see there is probably no need to convert it. This code: text = [y.text for x in player_...
miltmobley Web Scraping & Web Development 5 5,042 Oct-09-2017, 09:40 PM
    Thread: problems building python on win32 xp
Post: RE: problems building python on win32 xp

While considering a reply, I discovered a 2.7.14 msi file buried among 3.x versions in a long list of installers on python.org website. I installed it in the XP system, and the python shell launches o...
miltmobley General Coding Help 4 3,731 Oct-09-2017, 09:02 PM
    Thread: compacting multiple ranges
Post: RE: compacting multiple ranges

With such a small set of output values, the easiest approach is if-then-else statements: Pseudocode: if <s in range_1>: return 1 elif <s in range_2>: return 2 ... <s in ...
miltmobley General Coding Help 2 3,113 Oct-09-2017, 03:15 AM
    Thread: Syntax error in def
Post: RE: Syntax error in def

You have another problem. A statement like: if s != '7' or '14' or '30': will not do what you expect, since '14' and '30' will be interpreted as True (not False, None or zero), and the whole statemen...
miltmobley Homework 8 6,336 Oct-09-2017, 03:01 AM
    Thread: problems building python on win32 xp
Post: problems building python on win32 xp

I am trying to build python from source on an older machine running win32 XP SP3. Apparently the providers of prebuilt win32 versions no longer support XP. I have Visual Studio 8 installed. It compile...
miltmobley General Coding Help 4 3,731 Oct-08-2017, 11:22 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020