Python Forum
multiple number format conversion
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple number format conversion
#1
Hi everyone, please help! Below is a code I created for the conversion of decimal into binary. Now I want to expand the code so that the user can choose any number format( I only want to use base numbers 2-9 ). I'm a beginner, so don't quite know where to start here. I've tried everything from creating multiple lists to changing the append, but no luck! Any help, hints would be much appreciated. Thanks :)

number = 0
intermediateResult = 0
remainder = []
number = int(input("Please insert value for conversion: "))
while number != 0:
    remainder.append(number % 2)
    number = number // 2
remainder.reverse()
for result in remainder:
    print(result, end = "")
Reply


Messages In This Thread
multiple number format conversion - by oli_action - Aug-10-2020, 07:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do you format Update statement with multiple conditions hammer 4 2,110 Dec-16-2021, 10:49 PM
Last Post: hammer
Photo How can I use 2 digits format for all the number? plumberpy 6 2,356 Aug-09-2021, 02:16 PM
Last Post: plumberpy
  stopping number conversion before end Skaperen 6 3,012 Jul-12-2020, 09:22 AM
Last Post: DeaD_EyE
  Money conversion - problems with lists and .format function fatherted99 1 1,826 Mar-12-2020, 06:29 PM
Last Post: ndc85430
  Parquet format conversion problem Bilhardas 1 1,659 Nov-19-2019, 11:06 AM
Last Post: baquerik
  naming images adding to number within multiple functions Bmart6969 0 1,930 Oct-09-2019, 10:11 PM
Last Post: Bmart6969
  Number format william888 3 2,843 Aug-23-2019, 05:33 AM
Last Post: ThomasL
  Changing Number Format moby 4 5,066 May-24-2019, 11:04 PM
Last Post: snippsat
  Date format conversion "/Date(158889600000)/" lbitten 2 2,842 Nov-29-2018, 02:14 PM
Last Post: Larz60+
  Counting the number of files related to particular format ambush 3 2,945 Nov-05-2018, 08:58 AM
Last Post: buran

Forum Jump:

User Panel Messages

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