Question: How do I make this python code for partition number, start sector, size in sectors , end sector, capacity and none into a tabular format?#

How do I make this python code for partition number, start sector, size in sectors, end sector, capacity and none into a tabular format?# Input partial hex string
hexstring =(input("Enter the hex string: ")) # this is the input statement that you should have.
partition_1= hexstring[0:32] #Slices out partition 1
starting_lba_address = partition_1[16:24] #Slices out the starting LBA Address
size_in_sectors = partition_1[24:32] #Slices out the size in sectors
starting_chs_address ='020300'
partition_type ='06'
ending_chs_address ='0333C7'
#starting_lba_address ='80000000'
#Input sectors
#size_in_sectors ='00100300'
le_starting_lba_address = starting_lba_address[6:8]+ starting_lba_address[4:6]+ starting_lba_address[2:4]+ starting_lba_address[0:2]
le_size_in_sectors = size_in_sectors[6:8]+ size_in_sectors[4:6]+ size_in_sectors[2:4]+ size_in_sectors[0:2]
# change hex string to bytes
decimal_for_le_starting_lba_address = int(le_starting_lba_address, 16)
decimal_for_le_size_in_sectors = int(le_size_in_sectors,16)
capacity = decimal_for_le_size_in_sectors*512/1048576
#print for results
print('Partition 1:')
#print('Starting CHS Address:', starting_chs_address)
#print('Partition Type:', partition_type)
#print('Ending CHS Address:', ending_chs_address)
#print('Starting LBA Address:', starting_lba_address)
#print('Size in sectors:', size_in_sectors)
#print('LE Starting LBA Address:', le_starting_lba_address)
#print('LE Size in sectors:', le_size_in_sectors)
print('The decimal for the LE Starting LBA Address:', decimal_for_le_starting_lba_address)
print('The decimal for the LE Size in sectors:', decimal_for_le_size_in_sectors)
print ('Capacity', capacity)
# Input partial hex string
hexstring =(input("Enter the hex string: "))
partition_2= hexstring[0:32] #Slices out partition 2
starting_lba_address = partition_2[16:24] #Slices out the starting LBA Address
size_in_sectors = partition_2[24:32] #Slices out the size in sectors
starting_chs_address ='020300'
partition_type ='06'
ending_chs_address ='0333C7'
#starting_lba_address ='80000000'
#Input sectors
#size_in_sectors ='00100300'
le_starting_lba_address = starting_lba_address[6:8]+ starting_lba_address[4:6]+ starting_lba_address[2:4]+ starting_lba_address[0:2]
le_size_in_sectors = size_in_sectors[6:8]+ size_in_sectors[4:6]+ size_in_sectors[2:4]+ size_in_sectors[0:2]
# change hex string to bytes
decimal_for_le_starting_lba_address = int(le_starting_lba_address, 16)
decimal_for_le_size_in_sectors = int(le_size_in_sectors,16)
capacity = decimal_for_le_size_in_sectors*512/1048576
#print for results
print('Partition 2:')
#print('Starting CHS Address:', starting_chs_address)
#print('Partition Type:', partition_type)
#print('Ending CHS Address:', ending_chs_address)
#print('Starting LBA Address:', starting_lba_address)
#print('Size in sectors:', size_in_sectors)
#print('LE Starting LBA Address:', le_starting_lba_address)
#print('LE Size in sectors:', le_size_in_sectors)
print('The decimal for the LE Starting LBA Address:', decimal_for_le_starting_lba_address)
print('The decimal for the LE Size in sectors:', decimal_for_le_size_in_sectors)
print ('Capacity', capacity)
# Input partial hex string
hexstring =(input("Enter the hex string: "))
partition_3= hexstring[0:32] #Slices out partition 3
starting_lba_address = partition_3[16:24] #Slices out the starting LBA Address
size_in_sectors = partition_3[24:32] #Slices out the size in sectors
starting_chs_address ='020300'
partition_type ='06'
ending_chs_address ='0333C7'
#starting_lba_address ='80000000'
#Input sectors
#size_in_sectors ='00100300'
le_starting_lba_address = starting_lba_address[6:8]+ starting_lba_address[4:6]+ starting_lba_address[2:4]+ starting_lba_address[0:2]
le_size_in_sectors = size_in_sectors[6:8]+ size_in_sectors[4:6]+ size_in_sectors[2:4]+ size_in_sectors[0:2]
# change hex string to bytes
decimal_for_le_starting_lba_address = int(le_starting_lba_address, 16)
decimal_for_le_size_in_sectors = int(le_size_in_sectors,16)
capacity = decimal_for_le_size_in_sectors*512/1048576
#print for results
print('Partition 3:')
#print('Starting CHS Address:', starting_chs_address)
#print('Partition Type:', partition_type)
#print('Ending CHS Address:', ending_chs_address)
#print('Starting LBA Address:', starting_lba_address)
#print('Size in sectors:', size_in_sectors)
#print('LE Starting LBA Address:', le_starting_lba_address)
#print('LE Size in sectors:', le_size_in_sectors)
print('The decimal for the LE Starting LBA Address:', decimal_for_le_starting_lba_address)
print('The decimal for the LE Size in sectors:', decimal_for_le_size_in_sectors)
print ('Capacity', capacity)
# Input partial hex string
hexstring =(input("Enter the hex string: "))
partition_4= hexstring[0:32] #Slices out partition 4
starting_lba_address = partition_4[16:24] #Slices out the starting LB

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!