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
"""Write a program which will find all such numbers | |
which are divisible by 7 but are not a multiple of 5, | |
between 2000 and 3200 (both included). | |
The numbers obtained should be | |
printed in a comma-separated sequence on a single line. | |
""" | |
result = [] | |
for num in range(2000, 3201): | |
if num % 7 == 0 and num % 5 != 0: |
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
"""find the all the possible prime number from the given integer number | |
input : 3657 | |
output : 3 5 7 37 53 67 73 367 563 653 673 | |
""" | |
import itertools | |
final_list = [] | |
num = raw_input("Enter no : ") | |
for x in range(1,len(num)+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
from random import randint | |
def cows_and_bulls(): | |
generated_no = randint(1000,9999) | |
print generated_no | |
x = 0 | |
count = 0 | |
while(True): | |
no = input("Enter 4 digit no : ") | |
no_list = list(str(no)) | |
print no |
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 reverse_word_order(sentence): | |
words = sentence.split(" ") | |
reverse_list = words[::-1] | |
reverse = '' | |
for i in reverse_list: | |
reverse = reverse +' '+ ''.join(i) | |
print reverse | |
reverse_word_order('My name is Sangram') |
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
import random | |
import string | |
from random import randint | |
def simple_password(count): | |
password = ''.join(random.choice(string.letters) for x in range(count)) | |
return password | |
def medium_strong_password(): |
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
count = input("How many times ") | |
fibonnaci = [] | |
first = 0 | |
second = 1 | |
for i in range(count): | |
result = first + second | |
fibonnaci.append(result) | |
first = second | |
second = result | |
print fibonnaci |