## return byte size

0 likes • Nov 19, 2022
Python

## More Python Posts

```#question1.pydef rose(n) :  if n==0 :     yield []  else :    for k in range(0,n) :          for l in rose(k) :        for r in rose(n-1-k) :                  yield [l]+[r]+[r]            def start(n) :  for x in rose(n) :       print(x) #basically I am printing x for each rose(n) file

print("starting program: \n")start(2) # here is where I call the start function```
```# Python program for implementation of Selection# Sortimport sysA = [64, 25, 12, 22, 11]
# Traverse through all array elementsfor i in range(len(A)):		# Find the minimum element in remaining	# unsorted array	min_idx = i	for j in range(i+1, len(A)):		if A[min_idx] > A[j]:			min_idx = j				# Swap the found minimum element with	# the first element			A[i], A[min_idx] = A[min_idx], A[i]
# Driver code to test aboveprint ("Sorted array")for i in range(len(A)):	print("%d" %A[i]),```
`x[cat_var].isnull().sum().sort_values(ascending=False)`

### Bogo Sort

CodeCatch
0 likes • Nov 19, 2022
Python
```# Python program for implementation of Bogo Sortimport random
# Sorts array a[0..n-1] using Bogo sortdef bogoSort(a):	n = len(a)	while (is_sorted(a)== False):		shuffle(a)
# To check if array is sorted or notdef is_sorted(a):	n = len(a)	for i in range(0, n-1):		if (a[i] > a[i+1] ):			return False	return True
# To generate permuatation of the arraydef shuffle(a):	n = len(a)	for i in range (0,n):		r = random.randint(0,n-1)		a[i], a[r] = a[r], a[i]
# Driver code to test abovea = [3, 2, 4, 1, 0, 5]bogoSort(a)print("Sorted array :")for i in range(len(a)):	print ("%d" %a[i]),```
`""" Number Guessing Game----------------------------------------"""import randomattempts_list = []def show_score():    if len(attempts_list) <= 0:        print("There is currently no high score, it's yours for the taking!")    else:        print("The current high score is {} attempts".format(min(attempts_list)))def start_game():    random_number = int(random.randint(1, 10))    print("Hello traveler! Welcome to the game of guesses!")    player_name = input("What is your name? ")    wanna_play = input("Hi, {}, would you like to play the guessing game? (Enter Yes/No) ".format(player_name))    // Where the show_score function USED to be    attempts = 0    show_score()    while wanna_play.lower() == "yes":        try:            guess = input("Pick a number between 1 and 10 ")            if int(guess) < 1 or int(guess) > 10:                raise ValueError("Please guess a number within the given range")            if int(guess) == random_number:                print("Nice! You got it!")                attempts += 1                attempts_list.append(attempts)                print("It took you {} attempts".format(attempts))                play_again = input("Would you like to play again? (Enter Yes/No) ")                attempts = 0                show_score()                random_number = int(random.randint(1, 10))                if play_again.lower() == "no":                    print("That's cool, have a good one!")                    break            elif int(guess) > random_number:                print("It's lower")                attempts += 1            elif int(guess) < random_number:                print("It's higher")                attempts += 1        except ValueError as err:            print("Oh no!, that is not a valid value. Try again...")            print("({})".format(err))    else:        print("That's cool, have a good one!")if __name__ == '__main__':    start_game()`
```import math
def factorial(n):    print(math.factorial(n))    return (math.factorial(n))    factorial(5)factorial(10)factorial(15)```