This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
numbers = [1, 2, 3, 4] | |
result = reduce(lambda x, y: x + y, numbers) | |
print(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} | |
set2 = {1, 2, 3, 4, 6} | |
''' | |
print(set1 & set2) | |
print(set2.issubset(set1)) | |
print(set1.union(set2)) | |
print(set1.issuperset(set2)) | |
print(set2.issuperset(set1)) | |
print(set1.intersection(set2)) | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N1 = int(input("Enter the first number: ")) | |
N2 = int(input("Enter the second number: ")) | |
addition = N1+N2 | |
subtraction = N1-N2 | |
multiplication = N1*N2 | |
division = N1/N2 | |
print("Addition: ", addition) |