This file contains 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
#!/bin/python3 | |
import math | |
import os | |
import random | |
import re | |
import sys | |
This file contains 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
if __name__ == '__main__': | |
a = int(input()) | |
b = int(input()) | |
print(a + b) | |
print(a - b) | |
print(a * b) |
This file contains 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
if __name__ == '__main__': | |
a = int(input()) | |
b = int(input()) | |
print(a // b) | |
print(a / b) |
This file contains 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
if __name__ == '__main__': | |
n = int(input()) | |
for i in range(n): | |
print(i * i) |
This file contains 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
def is_leap(year): | |
leap = False | |
return year % 4 == 0 and (year % 400 == 0 or year % 100 != 0) | |
year = int(input()) | |
print(is_leap(year)) |
This file contains 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
if __name__ == '__main__': | |
n = int(input()) | |
for i in range(n+1): | |
if i==0: | |
continue | |
print(i, end="") | |
This file contains 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
if __name__ == '__main__': | |
n = int(input()) | |
for i in range(n+1): | |
if i==0: | |
continue | |
print(i, end="") | |
This file contains 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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
""" | |
For more understanding: https://www.programiz.com/python-programming/methods/set/symmetric_difference | |
""" | |
# '_' is a variable and input().split() will separate input from the console | |
_, a = input(), set(input().split()) | |
_, b = input(), set(input().split()) | |
print(len(a.symmetric_difference(b))) |
This file contains 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
if __name__ == '__main__': | |
(_, A) = (int(input()),set(map(int, input().split()))) | |
B = int(input()) | |
for _ in range(B): | |
(command, newSet) = (input().split()[0],set(map(int, input().split()))) | |
getattr(A, command)(newSet) | |
print (sum(A)) |
This file contains 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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
K = int(input()) | |
set_S = set() | |
sumlist_S = 0 | |
for i in input().split(): | |
I = int(i) | |
set_S.add(I) | |
sumlist_S += I |
OlderNewer