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
# -*- coding: utf-8 -*- | |
# Calc age | |
name = raw_input("Name >>> ") | |
age = int(raw_input("Age >>> ")) | |
year = 2016 | |
while(age < 101): |
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
# -*- coding: utf-8 -*- | |
# Odd or Even | |
no = int(raw_input("Enter the number >>> ")) | |
if no % 2 == 0: | |
print "It is a even number" |
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
# -*- coding: utf-8 -*- | |
# List Less Than Ten | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
x = [] | |
choice = int(raw_input("Enter a number between 0 and 90 >>")) |
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
# -*- coding: utf-8 -*- | |
# Divisors | |
number = int(raw_input(">>> " )) | |
x = range (1, number+1) | |
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
# List Overlap Solutions | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
for element in a: | |
for x in b: | |
if element == x: |
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 bubbleSort(lst): | |
nums = list(lst) | |
for i in range(len(lst)): | |
for j in range(i+1, len(lst)): | |
if lst[j] < lst[i]: | |
lst[j], lst[i] = lst[i], lst[j] | |
return lst |
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
#Hackerrank ------ Nested Lists | |
from collections import defaultdict | |
grades = defaultdict(list) | |
for _ in range(input()): | |
name = raw_input() | |
score = float(raw_input()) |
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
#Hackerrank ------ Finding the percentage | |
if __name__ == '__main__': | |
n = int(raw_input()) | |
student_marks = {} | |
for _ in range(n): | |
line = raw_input().split() | |
name, scores = line[0], line[1:] | |
scores = map(float, scores) |
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
#Hackerrank Python If-Else | |
#https://www.hackerrank.com/challenges/py-if-else | |
if __name__ == '__main__': | |
n = int(raw_input()) | |
if n% 2 != 0: | |
print "Weird" |
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
#https://www.hackerrank.com/challenges/python-loops | |
if __name__ == '__main__': | |
n = int(raw_input()) | |
for i in range(n): | |
print i ** 2 |
OlderNewer