Skip to content

Commit e00aa01

Browse files
committed
Done Conditional Statement with mini calcu project
1 parent b19bed9 commit e00aa01

File tree

15 files changed

+283
-87
lines changed

15 files changed

+283
-87
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""====================================[AND Operator]========================================"""
2+
3+
# age = int(input("Enter your age: "))
4+
# height = int(input("Enter your height: "))
5+
6+
# if age >= 18 and height >= 176:
7+
# print("Legal age and tall")
8+
# elif age >= 18 and height >= 150:
9+
# print("Legal age but average")
10+
# elif age >= 18:
11+
# print("Legal age but short")
12+
# else:
13+
# print("Underage")
14+
# username = input("Enter your username: ")
15+
# password = input("Enter your password: ")
16+
17+
# if username == "night" and password == "admin":
18+
# print(f"Login successful\nWelcome {username}")
19+
# elif username == "Dev" and password == "admin123":
20+
# print(f"Login successful\nWelcome {username}")
21+
# else:
22+
# print("Invalid username or password")
23+
24+
"""====================================[OR Operator]========================================"""
25+
26+
# Teacher said you need to bring a meter stick or a ruler and water to class
27+
hasMeterStick = False
28+
hasRuler = True
29+
hasWater = True
30+
31+
if hasMeterStick and hasWater or hasRuler and hasWater:
32+
print("You can enter the class")
33+
else:
34+
print("You can't enter the class")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Grade Average Program
3+
4+
Create a program that makes the user input 3 grades and then calculates the average of the grades.
5+
then check if the grade is:
6+
7+
> 100 or <=50 ~ Invalid Grade
8+
98 - 100 ~ Highest Honor
9+
95 - 97 ~ With High Honors
10+
90 - 94 ~ With Honors
11+
75 - 89 ~ Pass
12+
74 - 51 ~ Failed
13+
14+
"""
15+
16+
G1 = int(input("Enter the first grade: "))
17+
G2 = int(input("Enter the second grade: "))
18+
G3 = int(input("Enter the third grade: "))
19+
20+
ave = (G1 + G2 + G3) / 3
21+
22+
print("The average is: ", str(ave))
23+
24+
if ave > 100 or ave <= 50:
25+
print("Invalid Grade")
26+
elif ave >= 98 and ave <= 100:
27+
print("Highest Honor")
28+
elif ave >= 95 and ave <= 97:
29+
print("With High Honors")
30+
elif ave >= 90 and ave <= 94:
31+
print("With Honors")
32+
elif ave >= 75 and ave <= 89:
33+
print("Pass")
34+
else:
35+
print("Failed")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bag = ["wallet","gun","pen","phone","laptop"]
2+
3+
if "gun" in bag or "wallet" in bag or "phone" in bag or "laptop" in bag:
4+
print("Got you")
5+
else:
6+
print("You May Enter!")
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<mxfile host="65bd71144e">
2+
<diagram id="GzQR-BrQ4O8IbH32e_vW" name="Page-1">
3+
<mxGraphModel dx="1068" dy="940" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="1700" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="6" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="3" target="4">
8+
<mxGeometry relative="1" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="3" value="Start" style="ellipse;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
11+
<mxGeometry x="80" y="70" width="120" height="80" as="geometry"/>
12+
</mxCell>
13+
<mxCell id="10" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="4" target="7">
14+
<mxGeometry relative="1" as="geometry"/>
15+
</mxCell>
16+
<mxCell id="24" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="4" target="23">
17+
<mxGeometry relative="1" as="geometry">
18+
<Array as="points">
19+
<mxPoint x="135" y="550"/>
20+
</Array>
21+
</mxGeometry>
22+
</mxCell>
23+
<mxCell id="4" value="if age &lt;br&gt;&amp;gt;= 18" style="rhombus;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
24+
<mxGeometry x="70" y="190" width="130" height="120" as="geometry"/>
25+
</mxCell>
26+
<mxCell id="5" value="&lt;h1&gt;Nested if&lt;/h1&gt;&lt;div&gt;Used when dealing with Condition after a condition&lt;/div&gt;&lt;div&gt;age = 18&lt;/div&gt;&lt;div&gt;height = 176&lt;/div&gt;" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
27+
<mxGeometry x="280" y="10" width="490" height="170" as="geometry"/>
28+
</mxCell>
29+
<mxCell id="12" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="7" target="11">
30+
<mxGeometry relative="1" as="geometry"/>
31+
</mxCell>
32+
<mxCell id="15" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="7" target="14">
33+
<mxGeometry relative="1" as="geometry"/>
34+
</mxCell>
35+
<mxCell id="7" value="if height &lt;br&gt;&amp;gt;= 176" style="rhombus;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
36+
<mxGeometry x="330" y="200" width="130" height="100" as="geometry"/>
37+
</mxCell>
38+
<mxCell id="9" value="True" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
39+
<mxGeometry x="230" y="210" width="60" height="30" as="geometry"/>
40+
</mxCell>
41+
<mxCell id="25" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0;entryDx=0;entryDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="11" target="23">
42+
<mxGeometry relative="1" as="geometry"/>
43+
</mxCell>
44+
<mxCell id="11" value="Legal age and tall" style="rounded=0;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
45+
<mxGeometry x="335" y="350" width="120" height="60" as="geometry"/>
46+
</mxCell>
47+
<mxCell id="13" value="True" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
48+
<mxGeometry x="310" y="300" width="60" height="30" as="geometry"/>
49+
</mxCell>
50+
<mxCell id="18" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="14" target="17">
51+
<mxGeometry relative="1" as="geometry"/>
52+
</mxCell>
53+
<mxCell id="21" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="14" target="20">
54+
<mxGeometry relative="1" as="geometry">
55+
<Array as="points">
56+
<mxPoint x="790" y="250"/>
57+
</Array>
58+
</mxGeometry>
59+
</mxCell>
60+
<mxCell id="14" value="if height &lt;br&gt;&amp;gt;= 150" style="rhombus;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
61+
<mxGeometry x="530" y="200" width="130" height="100" as="geometry"/>
62+
</mxCell>
63+
<mxCell id="16" value="Fa;lse" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
64+
<mxGeometry x="460" y="210" width="60" height="30" as="geometry"/>
65+
</mxCell>
66+
<mxCell id="26" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="17" target="23">
67+
<mxGeometry relative="1" as="geometry">
68+
<Array as="points">
69+
<mxPoint x="600" y="510"/>
70+
</Array>
71+
</mxGeometry>
72+
</mxCell>
73+
<mxCell id="17" value="Legal age but average" style="rounded=0;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
74+
<mxGeometry x="535" y="350" width="120" height="60" as="geometry"/>
75+
</mxCell>
76+
<mxCell id="19" value="True" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
77+
<mxGeometry x="520" y="300" width="60" height="30" as="geometry"/>
78+
</mxCell>
79+
<mxCell id="27" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=16;" edge="1" parent="1" source="20" target="23">
80+
<mxGeometry relative="1" as="geometry">
81+
<Array as="points">
82+
<mxPoint x="800" y="550"/>
83+
</Array>
84+
</mxGeometry>
85+
</mxCell>
86+
<mxCell id="20" value="Legal age but short" style="rounded=0;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
87+
<mxGeometry x="730" y="350" width="120" height="60" as="geometry"/>
88+
</mxCell>
89+
<mxCell id="23" value="End" style="ellipse;whiteSpace=wrap;html=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
90+
<mxGeometry x="380" y="510" width="120" height="80" as="geometry"/>
91+
</mxCell>
92+
<mxCell id="28" value="Fa;lse" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
93+
<mxGeometry x="690" y="210" width="60" height="30" as="geometry"/>
94+
</mxCell>
95+
<mxCell id="29" value="Fa;lse" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;fontSize=20;" vertex="1" parent="1">
96+
<mxGeometry x="60" y="350" width="60" height="30" as="geometry"/>
97+
</mxCell>
98+
</root>
99+
</mxGraphModel>
100+
</diagram>
101+
</mxfile>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
age = 18
2+
height = 170
3+
4+
if age >= 18:
5+
if height >= 170:
6+
print("Legal age and tall")
7+
elif height >= 150:
8+
print("Legal age but average")
9+
else:
10+
print("Legal age but short")
11+
else:
12+
print("Underage")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
age = int(input("Enter you age"))
2+
3+
if age >= 18:
4+
print("Legal age")
5+
else:
6+
print("Too young")
7+
8+
print("Done")
Loading
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
age = int(input("Enter you age"))
2+
3+
if age >= 18:
4+
print("Legal age")
5+
if age >= 13:
6+
print("Teenager")
7+
else:
8+
print("Too young")
9+
10+
print("Done")

0 commit comments

Comments
 (0)