-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRevi.py
59 lines (45 loc) · 1.5 KB
/
Revi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'''
def multiplication_table(start,end):
for x in range(start,end+1):
for y in range(1,11):
print(f"{x} X {y} = {x*y}")
print('-----------')
multiplication_table(5,10)
'''
'''
def count_words(self,sentence):
word_count = len(sentence.split())
return word_count
'''
class Game:
def __init__(self):
while True:
print('''
Welcom In Our Game
1 : Multiplication Table Game
2 : World Count Game
3 : press X to exit
''')
user_choice =(input('Enter Your Choice : '))
if user_choice =='X':
break
if int(user_choice) == 1:
start = int(input('Enter Start: '))
end = int(input('Enter End: '))
self.multiplication_table(start,end)
elif int(user_choice) == 2:
mysentence = input('Enter Sentence: ')
count = self.count_words(mysentence)
print(count)
play_again = input('press any key to play Again , N for exit :')
if play_again == 'N':
break
def multiplication_table(self,start,end):
for x in range(start,end+1):
for y in range(1,11):
print(f"{x} X {y} = {x*y}")
print('-----------')
def count_words(self,sentence):
word_count = len(sentence.split())
return word_count
g1 = Game()