Promote, Protect, and Advance

This page provides the code to the challenges developed by Pychallenges.net.

The software created is free of use and based on the GNU License and can be distributed freely, though with proper attribution.

If you would like to develop software with Pychallenges.net, Please send us an email.

Challenge Overview

The intent of the challenges below are to present easy problems first, so that you can progress onto harder problems as you go along. The challenges do have solutions, which I am willing to compare with from those of your own. What I hope for is that these initial problems will get someone that is a beginner or a veteran to think deeper into coding problems in general, but with a Python mindset. Please present what issues you run into with the challenges themselves to me via email.

Lastly, any feedback on the challenges is welcomed immensely and I would be grateful for suggestions, insights, or even miscellaneous thoughts. If you'd like to contribute to the challenges themselves, please reach me via the email above and we can work together to add more challenges for future users.

Thank you!

Challenges two and eight use 'return' statements -- the remaining challenges can be solved using 'print' statements.

Python Challenges

Challenge #1 | Hello World

def hello():

# Output should read as follows: # hello world!

Your code here

hello()

Challenge #2 | Word Length

def get_length(animals):

# Given a list words, return the count of the word # Output should look as follows: # {'dog': 3, 'cat': 3, 'giraffe': 7, 'penguin': 7, 'puma': 4}

Your code here

print(get_length(['dog', 'cat', 'giraffe', 'penguin', 'puma']))

Challenge #3 | Is Palindrome?

def palindrome(word):

# solution should check to see if the word passed in as input # is a palindrome and return True if so, otherwise return False.

Your code here

palindrome("racecar") palindrome("hannah") palindrome("magic") palindrome("hands") palindrome("anna")

Challenge #4 | Reverse The String!

def reverse_str(string):
  

Your code here

reverse_str("drow") reverse_str("rood") reverse_str("leahcim") reverse_str("ekib")

Challenge #5 | Solve The Antonym

def solve_antonym(phrase):

# solution should ouput the following antonyms: # First In Last Out -> FIFO # Complementary Metal Oxide-Semiconductor -> CMOS # Something That You Made Up -> STUMU # Portable Network Graphics -> PNG

Your code here

solve_antonym("First In Last Out") solve_antonym("Complementary Metal Oxide-Semiconductor") solve_antonym("Something That You Made Up") solve_antonym("Portable Network Graphics")

Challenge #6 | DNA Sequencer

def dna_sequencer():

# Your code should output a 15 character dna # sequence using only the character set "atgc" # Output should look as follows: #[START] Sequence Generation [START] # Sequence 1: ggatgtcatggtgccgaaac # Sequence 2: tggctaaccctcgggagtga # Sequence 3: cctcctcacagttccgtaag # Sequence 4: acccacttcaatcgttcgtg # Sequence 5: gtatccacaggataccccgg

Your code here

dna_sequencer()

Challenge #7 | Dictionary Formatter

def dict_formatter():

# Given a dictionary with values as input, reconstruct the dict # to look as follows: dict1 = {"a": 1, "b": 2, "c_d": 3, "c_e": 4}

Your code here

dict_formatter({"a": 1, "b": 2, "c": {"d": 3, "e": 4}})

Challenge #8 | secret_to_hash

def encode_decode_secret(secret):

# For a given secret, return the secret as a hex represented hash # Output should be as follows: # Msg: hello world Encrypted Msg: A7D26CAC09E0419 Decrypted Msg: hello world # Msg: left Encrypted Msg: D62FD18B22C456A Decrypted Msg: left # Msg: rhino Encrypted Msg: F1625973F00A8A0 Decrypted Msg: rhino # Msg: wheel Encrypted Msg: F4F5EFCD63433B3 Decrypted Msg: wheel # Msg: word Encrypted Msg: EC8F38A8FCA9724 Decrypted Msg: word

Your code here

print(encode_decode_secret("hello world")) print(encode_decode_secret("left")) print(encode_decode_secret("rhino")) print(encode_decode_secret("wheel")) print(encode_decode_secret("word")) print(encode_decode_secret("beak")) print(encode_decode_secret("weird")) print(encode_decode_secret("tower")) print(encode_decode_secret("ignite")) print(encode_decode_secret("lazy")) print(encode_decode_secret("power")) print(encode_decode_secret("redrum"))