Skip to content
This repository
Browse code

Merge branch 'master', remote-tracking branch 'origin'

  • Loading branch information...
commit d0e093b5159887023122c629a2cee85195941a46 2 parents 7b53d2f + 175ca0c
Issa Rice riceissa authored

Showing 1 changed file with 45 additions and 0 deletions. Show diff stats Hide diff stats

  1. +45 0 caesar_get_input.py
45 caesar_get_input.py
... ... @@ -0,0 +1,45 @@
  1 +def main_menu():
  2 + usr_choice = input('q for quit, d for decode, e for encode: ')
  3 + if usr_choice == 'q':
  4 + pass
  5 + elif usr_choice == 'd':
  6 + decode(get_usr_decode_choice(), get_usr_str('decode'), get_usr_rot())
  7 + elif usr_choice == 'e':
  8 + encode(get_usr_str('encode'), get_usr_rot())
  9 + else:
  10 + print('Bad command, try again')
  11 + return main_menu()
  12 +
  13 +def get_usr_str(verb):
  14 + return input('Give me a string to {0}: '.format(verb))
  15 +
  16 +def get_usr_rot():
  17 + # TODO: need to add check to validate user input
  18 + return int(input('Give me a rotation: '))
  19 +
  20 +def get_usr_decode_choice():
  21 + usr_choice = input('s for simple decode, c for complex decode: ')
  22 + if usr_choice == 's' or usr_choice == 'c':
  23 + return usr_choice
  24 + else:
  25 + print('Bad command, try again')
  26 + return get_usr_decode_choice()
  27 +
  28 +def encode(usr_str, usr_rot):
  29 + pass
  30 +
  31 +def decode(usr_choice, usr_str, usr_rot):
  32 + if usr_choice == 's':
  33 + simple_decode(usr_str, usr_rot)
  34 + elif usr_choice == 'c':
  35 + complex_decode(usr_str, usr_rot)
  36 + else:
  37 + print('ERROR: usr_choice is either s or c')
  38 +
  39 +def simple_decode(usr_str, usr_rot):
  40 + pass
  41 +
  42 +def complex_decode(usr_str, usr_rot):
  43 + pass
  44 +
  45 +main_menu()

0 comments on commit d0e093b

Please sign in to comment.
Something went wrong with that request. Please try again.