BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup

Join the forum, it's quick and easy

BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup
BullyWiiHacks
Would you like to react to this message? Create an account in a few clicks or log in to continue.
BullyWiiHacks

Gaming, Modding & Programming

Important reminders:

- Click *HERE* for advanced forum search or check out the text field below on the front page for Google before posting
- NO support via private message (use the forum)
- Write meaningful topic titles
Site Translation
Latest topics
» Lego Stars Wars: The Complete Saga [RLGE64]
Python - Convert Decimal to Hex Empty11/12/2024, 3:19 am by SnB@BWH

» JMaster Duel Bot: A Yu-Gi-Oh! Master Duel Bot and Trainer for Steam
Python - Convert Decimal to Hex Empty11/10/2024, 5:26 am by Bully@WiiPlaza

» Error Injecting Drool Links Saliva Mod Menu
Python - Convert Decimal to Hex Empty11/10/2024, 5:24 am by Bully@WiiPlaza

» USB Gecko problems with some games
Python - Convert Decimal to Hex Empty10/16/2024, 1:59 pm by Reclaimer Shawn

» Metal Gear Solid V The Phantom Pain X Flashpoint Batman Gameplay unedited [Seth@WiiPlaza]
Python - Convert Decimal to Hex Empty9/23/2024, 12:48 pm by Seth@WiiPlaza

» Dropped Out of College to Pursue Web Dev and Life Pursuits in General
Python - Convert Decimal to Hex Empty8/9/2024, 7:09 am by SnB@BWH

» ASM <> Gecko Code Converter
Python - Convert Decimal to Hex Empty7/29/2024, 11:15 am by Mac11ngAround

» German With a Jackhammer
Python - Convert Decimal to Hex Empty7/28/2024, 3:42 pm by SnB@BWH

» Wii RAM Hacking: Pointers and ASM
Python - Convert Decimal to Hex Empty7/23/2024, 1:54 pm by Mac11ngAround

» IBM AIX Assembler Programming Reference - Useful For PPC ASM
Python - Convert Decimal to Hex Empty7/21/2024, 5:00 pm by Mac11ngAround

Search
 
 

Display results as :
 


Rechercher Advanced Search

November 2024
MonTueWedThuFriSatSun
    123
45678910
11121314151617
18192021222324
252627282930 

Calendar Calendar

Country Statistics
Free counters!

You are not connected. Please login or register

Python - Convert Decimal to Hex

Go down  Message [Page 1 of 1]

1Python - Convert Decimal to Hex Empty Python - Convert Decimal to Hex 5/25/2019, 8:26 pm

SnB@BWH

SnB@BWH
Admin & Writer

I will give you the rundown of how this very simple code works.

x = int(input("Enter a number: "))
print(hex(x))

x is our variable. It holds a value.
int tells Python that we are using integers (regular numbers).
input uses the string (text in quotes) to display the message to user to tell them to enter a number. When int is used, the only thing that can be used is a number. Python is smart this way.
print... prints the expression in the parentheses. In this case, it prints the answer to the operation (the decimal conversion).

Now, what about the parentheses? This is where a lot of beginner programmers have trouble with... it took me a few minutes too, so don't worry.

The parentheses tell Python what to do first; much like BEDMAS (or whatever it's called). Whatever is in the middle parentheses is done first, then the outer, then so on and so forth. The first line in the code asks for user to enter a number. Checks if value entered is an integer. If it is, it takes the inputted number and stores it in the variable x. Then proceeds to the next line. The second line gets the value entered into the variable x, and then converts to hex. Finally, the operation output is printed.

Python - Convert Decimal to Hex Screen14

That's it! Simple, isn't it?  Smile


_________________
Python - Convert Decimal to Hex Simple10

Python - Convert Decimal to Hex LSTjSyDDiscord: SnB_BWH

Click HERE to earn free bitcoin, litecoin, dogecoin, and dash!

Win Free Bitcoins every hour!

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum