forked from aiti-ghana-2012/Lab_Python_02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUsingControlStructures.py
73 lines (48 loc) · 1.08 KB
/
UsingControlStructures.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#Q5
theInput = input("Enter an integer: ")
#Your code here
#int(theInput)
if theInput%2==0:
print 'even'
else:
print 'odd'
print '----------------------------------------------------'
#Q6
primarySchoolAge= 4
legalVotingAge =18
agePresident = 40
officialRetirementAge= 60
personAge= input('Enter your Age: ')
if personAge < 4:
print ('Too young')
elif personAge > 17:
print 'Remember to vote'
if personAge>= 40 :
if personAge>60:
print "You can't b president"
print "Too old"
else:
print 'vote for me'
#else:
#print'Too old'
print '------------------------------------------------------'
#Q7
i=40
while i>0:
i-=1
if i%3== 0:
print i
print '---------------------------------------------------------'
# Q8
for i in range(7,30):
if i%2!=0 and i%3!=0 and i%5!=0:
print i
print '---------------------------------------------------------'
# Q9
n= 1
while n>0:
n+=1
if 79*n%97==1:
print n
if n%2==0:
break