File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed
Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,6 @@ Level 1
116116Question:
117117Define a class which has at least two methods:
118118getString: to get a string from console input
119- printString: to print the string in upper case.
120119Also please include simple test function to test the class methods.
121120
122121Hints:
@@ -2352,6 +2351,7 @@ Question:
23522351Write a program to solve a classic ancient Chinese puzzle:
23532352We count 35 heads and 94 legs among the chickens and rabbits in a farm. How many rabbits and how many chickens do we have?
23542353
2354+ Hint:
23552355Hint:
23562356Use for loop to iterate all possible solutions.
23572357
@@ -2372,4 +2372,3 @@ print solutions
23722372
23732373#----------------------------------------#
23742374
2375-
Original file line number Diff line number Diff line change 1+ import math
2+
13def printnumbers ():
24 numbers = []
35 k = 1
@@ -35,5 +37,36 @@ def splitthestr(s):
3537 print (slist )
3638 print (tuple (slist ))
3739
38- sa = input ("give numbers" )
39- splitthestr (sa )
40+ #sa = input("give numbers")
41+ #splitthestr(sa)
42+
43+ class TestClass :
44+
45+ def __init__ (self , name ):
46+ self .name = name ;
47+
48+ def getwelcomemessage (self ):
49+ print ('hello {}' .format (self .name ))
50+
51+ #tc = TestClass("Jubayer")
52+ #tc.getwelcomemessage()
53+
54+ # problem 6
55+
56+ def calculateQ (D ):
57+ C = 50
58+ H = 30
59+ Q = math .sqrt ((2 * C * D )/ H )
60+ return math .floor (Q )
61+ def getnumbers (st ):
62+ l = st .split (',' )
63+ nl = [int (x ) for x in l ]
64+ return nl
65+
66+ #s = input("--> Numbers: ")
67+ #l = [calculateQ(x) for x in getnumbers(s)]
68+ #l = map(str, l)
69+ #print (','.join(l))
70+
71+ #problem 7
72+
You can’t perform that action at this time.
0 commit comments