Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 2D List
- def negate(L):
- result = L
- for row in range(len(result)):
- for col in range(len(result[row])):
- result[row][col] = result[row][col] * 2
- return result
- print(negate([[1,2,3],[1,2,3],[1,2,3]]))
- # Recursive function
- def merge_characters (chars: 'list of strings and nested lists of strings') -> str:
- result = ""
- for element in chars:
- if type(element) == list:
- result = result + merge_characters(element)
- elif type(element) == str:
- result = result + element
- return result
- def reverse_a_string(string):
- if string == "":
- return string
- else:
- return reverse_a_string(string[1:]) + string[0]
- string = "ballsack"
- print(reverse_a_string("string"))
- def draw_lines(n: int, cavnas: tkinter.Canvas):
- width = canvas.winfo_width()
- height = canvas.winfo_height()
- num_lines = int((n+1) / 2)
- for i in range(num_lines):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement