1.The Python built-in function str() will convert a numerical argument into a character string representation, and the '+' can be used to concatenate strings together. Use these to modify the marathon script to produce cleaner output, for example:
Your speed is 7.74193548387 mph
Your total elapsed time is 46 minutes, 30 seconds
2.Use the Python built-in bin() to write a script that reads a base-10 integers
as input and outputs the corresponding binary representation of that
integer in ones and zeros.
3.The XOR operation is often used both for efficiently calculating checksums (see Section 1.9) and encryption (see Section 4.5). Write a simple Python script that reads in a number and outputs that number XORed with a pattern of ones and zeros, such as 0x55555555. The same script will “encrypt” a number into a seemingly unrelated number, but when run again and given the encrypted number as input will return the original number.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here