File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change 1- #Question 1
2- #Level 1
3- #
4- #Question:
5- #Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
6- #between 2000 and 3200 (both included).
7- #The numbers obtained should be printed in a comma-separated sequence on a single line.
8- #
9- #Hints:
10- #Consider use range(#begin, #end) method
11-
121def printnumbers ():
132 numbers = []
143 k = 1
@@ -25,5 +14,20 @@ def fact(n):
2514 fa = fa * d
2615 return fa ;
2716
28- n = int (input ('Number --> ' ))
29- print (fact (n ))
17+ #n = int(input('Number --> '))
18+ #print(fact(n))
19+
20+ #Problem 3, asks to print a dictionary where values are square of the key. n is input.
21+
22+ def sqdic (n ):
23+ return {x : x * x for x in range (1 ,n + 1 )}
24+
25+ def sqdic2 (n ):
26+ d = {}
27+ for x in range (1 ,n + 1 ):
28+ d [x ] = x * x ;
29+ return d
30+
31+ n = int (input ("Number->" ))
32+ print (sqdic2 (n ))
33+
You can’t perform that action at this time.
0 commit comments