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
116
116
Question:
117
117
Define a class which has at least two methods:
118
118
getString: to get a string from console input
119
- printString: to print the string in upper case.
120
119
Also please include simple test function to test the class methods.
121
120
122
121
Hints:
@@ -2352,6 +2351,7 @@ Question:
2352
2351
Write a program to solve a classic ancient Chinese puzzle:
2353
2352
We count 35 heads and 94 legs among the chickens and rabbits in a farm. How many rabbits and how many chickens do we have?
2354
2353
2354
+ Hint:
2355
2355
Hint:
2356
2356
Use for loop to iterate all possible solutions.
2357
2357
@@ -2372,4 +2372,3 @@ print solutions
2372
2372
2373
2373
#----------------------------------------#
2374
2374
2375
-
Original file line number Diff line number Diff line change
1
+ import math
2
+
1
3
def printnumbers ():
2
4
numbers = []
3
5
k = 1
@@ -35,5 +37,36 @@ def splitthestr(s):
35
37
print (slist )
36
38
print (tuple (slist ))
37
39
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