From 49723d45a5669e587bda250ecd4897d2a644ef72 Mon Sep 17 00:00:00 2001 From: Vicky-Raghuwanshi <67050782+Vicky-Raghuwanshi@users.noreply.github.com> Date: Wed, 27 Oct 2021 21:13:22 +0530 Subject: [PATCH] Update bubbleSort.py Multiple value input from user --- Code/bubbleSort.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Code/bubbleSort.py b/Code/bubbleSort.py index 1382633..2ae470c 100644 --- a/Code/bubbleSort.py +++ b/Code/bubbleSort.py @@ -16,10 +16,15 @@ def bubbleSort(arr): arr[j], arr[j+1] = arr[j+1], arr[j] # Driver code to test above -arr = [64, 34, 25, 12, 22, 11, 90] - +#arr = [64, 34, 25, 12, 22, 11, 90] +#instead of using a fixed size and fixed values/elements +#you can ask user to give the number as much he want + +arr = list(map(int,input().split())) + + bubbleSort(arr) print ("Sorted array is:") for i in range(len(arr)): - print ("%d" %arr[i]), + print(f"{arr[i]}")