|
[Sponsors] |
October 21, 2021, 11:01 |
Decimal to Binary in Python Code Error
|
#1 |
New Member
Vikash Daga
Join Date: Oct 2021
Location: India
Posts: 1
Rep Power: 0 |
I was trying to convert Decimal to Binary, there is no error in the code but while executing I am getting blank, not showing anything. Could someone help me figure out where is the mistake
Code:
def decimalToBinary(ip_val): if ip_val= 1: # recursive function call decimalToBinary(ip_val // 2) # printing remainder from each function call print(ip_val % 2, end = '') # Driver Code if __name__ == '__main__': # decimal value ip_val = 24 # Calling special function decimalToBinary(ip_val) |
|
October 21, 2021, 13:11 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
As a start, line 2:
Code:
if ip_val= 1: Code:
if ip_val >= 1: |
|
Tags |
python |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] blockMesh with double grading. | spwater | OpenFOAM Meshing & Mesh Conversion | 92 | January 12, 2019 10:00 |
OpenFOAM without MPI | kokizzu | OpenFOAM Installation | 4 | May 26, 2014 10:17 |
[swak4Foam] installing funkySetFields | igo | OpenFOAM Community Contributions | 1 | November 20, 2012 21:16 |
ParaView for OF-1.6-ext | Chrisi1984 | OpenFOAM Installation | 0 | December 31, 2010 07:42 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 07:25 |