return multiple values from a function

Jun 1, 2023CodeCatch

More Python Posts

Untitled

Jul 24, 2024AustinLeath

0 likes • 2 views

```from statistics import median, mean, mode
def print_stats(array):  print(array)  print("median =", median(array))  print("mean   =", mean(array))  print("mode   =", mode(array))  print()
print_stats([1, 2, 3, 3, 4])print_stats([1, 2, 3, 3])```

Caesar Encryption

Mar 10, 2021Skrome

0 likes • 1 view

```import string
def caesar(text, shift, alphabets):	def shift_alphabet(alphabet):	    return alphabet[shift:] + alphabet[:shift]		shifted_alphabets = tuple(map(shift_alphabet, alphabets))	final_alphabet = "".join(alphabets)	final_shifted_alphabet = "".join(shifted_alphabets)	table = str.maketrans(final_alphabet, final_shifted_alphabet)	return text.translate(table)
plain_text = "Hey Skrome, welcome to CodeCatch"print(caesar(plain_text, 8, [string.ascii_lowercase, string.ascii_uppercase, string.punctuation]))```

Untitled

Apr 21, 2023sebastianagauyao2002-61a8

0 likes • 0 views

`print("hellur")`

Hello World

Sep 9, 2023AustinLeath

0 likes • 15 views

`print("test")`
```my_list = [1, 2, 3, 4, 5]removed_element = my_list.pop(2)  # Remove and return element at index 2print(removed_element)  # 3print(my_list)  # [1, 2, 4, 5]
last_element = my_list.pop()  # Remove and return the last elementprint(last_element)  # 5print(my_list)  # [1, 2, 4]```

Input 2D Matrix

Nov 19, 2022CodeCatch

0 likes • 2 views

```# Input for row and columnR = int(input())C = int(input())
# Using list comprehension for inputmatrix = [[int(input()) for x in range (C)] for y in range(R)]```