From 6ce0c22e28b24ff562c34589338e1ac4759b7a29 Mon Sep 17 00:00:00 2001 From: MichaelTennyson <55544189+MichaelTennyson@users.noreply.github.com> Date: Thu, 16 Jan 2020 18:56:28 +0000 Subject: [PATCH] Add files via upload --- lab3(practice).py | 18 ++++++++++++++++++ tut2(practice).py | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 lab3(practice).py create mode 100644 tut2(practice).py diff --git a/lab3(practice).py b/lab3(practice).py new file mode 100644 index 0000000..70e4ef0 --- /dev/null +++ b/lab3(practice).py @@ -0,0 +1,18 @@ +# The following program scrambles a string, leaving the first and last letter be +# the user first inputs their string +# the string is then turned into a list and is split apart +# the list of characters are scrambled and concatenated + +import random + +print("this program wil take a word and will scramble it \n") +word = input("enter the word\n") + +word_list = list(word) + +for i in range(len(word_list)): + random.shuffle(word_list[1:-1]) + +scrambled_word = "".join(word_list) + +print(scrambled_word) diff --git a/tut2(practice).py b/tut2(practice).py new file mode 100644 index 0000000..c224501 --- /dev/null +++ b/tut2(practice).py @@ -0,0 +1,8 @@ +# tutorial 2 - practice + +num = int(input("enter an integer to be converted to binary\n")) + +bin_num = bin(num) + +print(bin_num) +