diff --git a/fix_exercise_number.py b/fix_exercise_number.py index f6d2163..6fdfb00 100644 --- a/fix_exercise_number.py +++ b/fix_exercise_number.py @@ -1,17 +1,23 @@ -import fileinput -counter = 1 - -input_file = input('Please enter the name of the file you want to edit: ') - -# fileinput module let us do changes in the same file -with fileinput.FileInput(files=input_file, inplace=True) as f: - for line in f: - if line.startswith('# ex.'): - replace_line = line - new_line = ('# ex.{}'.format(counter)) - print(line.replace(replace_line, new_line)) - counter += 1 - else: - print(line.strip()) # .strip() remove the extra blank lines - -print('Editing {} successfully'.format(input_file)) +''' +ex.1: +Create two variables a and b, and initially set them each to a different number. Write a program that swaps both values. +''' + +import numpy as np + +a = input('Please enter number a: ') + +b = input('Please enter number b: ') + +a, b = int(a), int(b) + +an_array = np.array([a, b]) + +a, b = int(an_array[1]), int(an_array[0]) + + +print(f''' +a: {a} + +b: {b} +''') \ No newline at end of file