forked from aiti-ghana-2012/Lab_Python_02
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsingControlStructures.py~
More file actions
47 lines (40 loc) · 1.15 KB
/
Copy pathUsingControlStructures.py~
File metadata and controls
47 lines (40 loc) · 1.15 KB
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
###Part 2
print "------------------------------------------------------"
###Question 5
theInput = raw_input("Enter an integer: ")
#Your code here
theInput = int(theInput)
if theInput%2 ==0:
print "Even integer"
else:
print "Odd integer"
print "------------------------------------------------------"
prim_age=5
leg_vot_age=18
prez_age=21
ret_age=60
personsAge = input("Enter an age: ")
if personsAge >= prim_age and personsAge < leg_vot_age:
print "You should be in school by now, you can't vote"
elif personsAge>ret_age:
print "Too old"
elif personsAge>=leg_vot_age and personsAge<prez_age:
print "Welcome!! Remember to vote \n You can't be president"
elif personsAge>prez_age and personsAge<=ret_age:
print"vote for me"
print "------------------------------------------------------"
###Question 7
num=40
while num>0:
if num%3==0:
print num
num=num-1
print"------------------------------------------------------"
###Question 8
for i in range(6,30):
if i%2==0:
print "Divisible by 2 : ",i
elif i%3==0:
print "Divisible by 3 : ",i
elif i%5==0:
print "Divisible by 5 : ",i