Python: some practice, questions and #%§'
|
05-16-2021, 10:17 AM
Post: #5
|
|||
|
|||
RE: Python: some practice, questions and #%§'
Another trap:
in your snipped: Quote: print('key= '+str(int(log2(k))))doesn't always return the correct key code due to the binary nature of floats. This can be avoided by replacing <int> by <round>. In this case <round> even doesn't need a second argument. For positive numbers it works like <ceil> from the math module. Quote: print('key= '+str(round(log2(k)))) Things like this could drive you crazy. Günter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Python: some practice, questions and #%§' - Guenter Schink - 05-12-2021, 09:10 PM
RE: Python: some practice, questions and #%§' - jkor - 05-15-2021, 01:04 AM
RE: Python: some practice, questions and #%§' - Guenter Schink - 05-15-2021, 11:05 PM
RE: Python: some practice, questions and #%§' - jkor - 05-16-2021, 12:06 AM
RE: Python: some practice, questions and #%§' - Guenter Schink - 05-16-2021 10:17 AM
|
User(s) browsing this thread: 1 Guest(s)