-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_dustbin.py
80 lines (73 loc) · 2.43 KB
/
code_dustbin.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
74
75
76
77
78
79
80
"""
age = input("Please insert your age dear citizen : " )
age = int(age)
majeur = False
if age >= 18:
majeur = True
if majeur:
print("Hello there,you are old enough to join the army")
else:
print("Case not known")
####
age = 25
while age < 50:
print("You are still very young dear citizen")
age += 1
alpha = "abcdefghijklmnopqrstuvwxyz"
for letters in alpha:
print(letters)
###
age = input("Please insert your age : ")
amount = input("Please insert your amount : ")
age = int(age)
amount = int(amount)
if age >= 40 or amount >= 500000:
print("Yes dear customer you can open a bank account with us")
else:
print("You can't open a bank account here dear customer")
###
fruits = ["banana","orange","pineapple","guava","watermelon","dungan"]
for each in fruits:
if each in ["banana","mango","ginger","pawpaw","coconut","dungan","marakucha","watermelon","guava","date"]:
print(each)
else:
print("Not in stock")
"""
#This is something that involves for loops and literally for loops are used when we are dealing with sequences
#what happens is that a variable is instanciated by the for instruction which successively takes each and every value of the sequence that is being
#covered
names = ['Kiima','Samy','john','james','mbale','kituta','Junior','Charles','Mumbere']
for name in names:
if name in ['Kiima','Samy','Ariko','Bob','Kambale','Kituta','Hervine','Charles','Jack','Ruth','Chala','Mumbere','Glody','Osarafu']:
print(name)
"""
import random
def multiply(number,max):
"""
#This is a function that prints out the multiplication table of any number
#and also prints out a list of twenty random numbers chosen from 10 to 1010 after each iteration
"""
for i in range(max):
print(i,"*",number,"=",i*number)
print(random.randint(10,1010))
"""
foo = []
while True:#an infinite loop to allow one to insert elements into container objects
item = input("Insert item : ")
if item == "":
print("Loop ended")
break
if item not in foo:
foo.append(item)
"""
test mycode with file openings
while True:
content = input("Please insert your content : ")
if content == "":
print("Sorry you inserted nothing and can't have access to the system's database")
break
else:
with open("C:/test/test_/hello.txt","w") as my_file:
my_file.write(content)
continue
"""