-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhundred.py
197 lines (157 loc) · 5.35 KB
/
hundred.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
yourname = input("name ")
whatyear = input ("Which year is it ")
print(yourname,"thinks it is " , whatyear)
print("uh , oh , you have been given a ", "\033[32m", "warning", "\033[0m", "for being a bad person ")
#if statement
myname = input("Whats your name ")
if myname == "Richard": #colon at the end indicates if that is fulllfilled the go on and ...
print ("welcome bigman")
print("you are one of the coolest guy ever seen niggah")
else:
print("who the fuck are you even dude")
#3. elif .. after if buh b4 else since else means everything
print("SECURE LOGIN")
username = input("username ")
if username == "Richard":
print("welcome mr ")
elif username == "suzanne":
print("hey madam")
else:
print("404 error try again please")
#4. adding some password to the code
print("""
SECURE LOGIN
To the number one platform
++++++++++++
""")
username = input("username ")
password = input("passsword ")
if username == "Richard" and password == "richard":
print("welcome mr safaricom is for you! ")
elif username == "suzanne" or password == "suzanne":
print("hey madam, welcome to safaricom customer care services ")
else:
print("404 error try again please")
# 5. nested if .. just noted that 2 inputs (diferent if else)
matthika = input ("Which is you best matatu from thika to nairobi ")
if matthika == "2nk":
print ("You value time!")
favourite = input ("who is your all time driver ")
if favourite == "keith Njamah":
print ("Nice taste")
else:
print("maybe havent met yours")
elif matthika == "supermetro":
print("You value your safety")
else:
print("Thats unroad worthy")
#day 6 of hundred days
x = int(input("Enter value of x "))
y = int(input("Enter value of y "))
z = int(input("Enter the value of z"))
if x < y :
print("x is less than y")
elif x > y:
print("x is greater than y")
elif x== y:
print("x is equal to y")
else:
print("its like your input aint working out")
#7. power of assigning variables.. assign each
name = input("Please enter the subscriber name ")
if name == "Davie" or name == "davie":
print("hello programmer")
else: print("Introduce yourself to the freelancers first")
print([1,2,3,4,5,6]*3)
#Day 7
favouriteTv = input ("whats your favourite tv mr idler??? ")
if favouriteTv == "Inooro":
print("your must be a kikuyu")
favouritePart = input("Which show just makaes you tuned in inooro ")
if favouritePart == "jera ino ciitu":
print("sawa kijana ya huruma")
else:
print("you have different taste from the many")
elif favouriteTv == "citizen":
print ("you are aging up my G")
elif favouriteTv == "mutongoi":
print("sawa wa kwitu")
else:
print( " This is a free country for your Tv choice")
#7. assignment project
print("fake fun finder")
anime = input(" whats your favourite anime")
if anime == "one piece":
print("oh really")
actor = input("name me any character")
if actor == "nami":
print("you got that but on pure chance")
job = input("okaythen, what is her role in the ship")
if job == "navigator":
print("Hmph")
bounty = input("what was her first bounty then ")
if bounty == "ummm":
# print ("seee fake piece of fun")
computer_science = float(input("kindly enter your marks "))
if computer_science > 100:
print("""
Try again
maximum score is 100 please
""")
elif computer_science >=90:
print( "A+ , excellent you must be happy ")
elif computer_science>=80:
print ("A-")
elif computer_science >=70:
print ("which is a B")
else:
print("Below avrege")
#8 Trial
name = input("Enter your name master ")
if name == "muhia" or name == "kyalo":
print ("Hello", name)
19. Epic move game
while exit != "yes":
print ("mmmh")
exit =input("Exit?: ")
# #while infinite loop ...if itss running them its definitely looped otherwise it exits
while True:
print("This program is running ")
goagain = input ("Go again?: ")
if goagain == "no":
break
print("aww , i was having a good codimg time ")
# # simple calculator by the use of while loop
counter = 0
while True:
answer = int (input("Enter number: "))
# print("Adding it up!")
counter += answer
print("current total is", counter)
addanother = input("Add another? ") #yes or no
if addanother == "no":
break
print ("bye MR:")
spam_amount =0
spam_amount = spam_amount + 4
if spam_amount > 0:
print("But I don't want ANY spam!")
viking_song = "Spam Spam Spam"
print(viking_song)
#for loop to loop if we know how many times to repeat
#with the syntax: for (new_var) in range (no. of values):
for counter in range(10):
print(counter)
principal = 1000
monthly_rate = 0.05* 0.12 #monthly rate
duration = 10*12 #loan amount in 12 months
principal = 1000 # Loan principal amount
interest_rate = 0.05/12 # Annual interest rate
loan_duration = 10*12 # Loan duration in years
monthly_payment = (principal *interest_rate) / (1 - (1 + interest_rate) ** -loan_duration)
print("Loan payment amount after 10 years:", round(monthly_payment, 2))
#using of a for loopnh
monthly_payment = 0
for i in range(loan_duration):
monthly_payment += (principal * interest_rate) / (1 - (1 + interest_rate) ** -loan_duration)
print("Loan payment amount after 10 years:", round(monthly_payment, 2))