Skip to content

Commit 3112f53

Browse files
authored
Add files via upload
0 parents  commit 3112f53

20 files changed

+304
-0
lines changed

#2.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import matplotlib.pyplot as plt
2+
# line 1 points
3+
x1 = [0,0.25,0.5,1,1.5,2]
4+
y1 = [0,4.07,4.57,5.07,5.57,6.07]
5+
# plotting the line 1 points
6+
plt.plot(x1, y1, label = "Intensity 100nm")
7+
8+
# line 2 points
9+
x2 = [0,0.25,0.5,1,1.5,2]
10+
y2 = [0,1.83,2.33,2.83,3.33,3.83]
11+
# plotting the line 2 points
12+
plt.plot(x2, y2, label = "Intensity 122nm")
13+
14+
# line 2 points
15+
x3 = [0,0.25,0.5,1,1.5,2]
16+
y3 = [0,0.52,1.02,1.52,2.02,2.52]
17+
# plotting the line 2 points
18+
plt.plot(x3, y3, label = "Intensity 140nm")
19+
20+
# naming the x axis
21+
plt.xlabel('Voltage')
22+
# naming the y axis
23+
plt.ylabel('Current')
24+
# giving a title to my graph
25+
plt.title('Constant intensity and different wavelength')
26+
27+
# show a legend on the plot
28+
plt.legend()
29+
30+
# function to show the plot
31+
plt.show()

Count_word.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
phone = input("Phone: ")
2+
digits_mapping = {
3+
"1": "One",
4+
"2": "Two",
5+
"3": "Three",
6+
"4": "Four"
7+
}
8+
output = ""
9+
for numbers in phone:
10+
output += digits_mapping.get(numbers, "!") + " "
11+
print(output)

Homework#2.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
turnON = "Turn on Laptop"
2+
Oclass = "Go to class"
3+
bathroom = "Go to Bathroom"
4+
print('Waking up Pseudocode')
5+
pee = input("Pee? Yes or No: ")
6+
if pee.upper() == "YES":
7+
print(f"{bathroom} then, {turnON}, then, {Oclass}")
8+
elif pee.upper() == "NO":
9+
print(f"{turnON} then, {Oclass}")
10+
11+
12+

TEst.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pizzas = ['pepperoni', 'Hawaiian', 'Cheese', 'Meaty']
2+
for pizza in pizzas:
3+
print(f"I like {pizza.title()} pizza")
4+
print("I love all of this pizzas")

automation_sample.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import openpyxl as xl
2+
from openpyxl.chart import BarChart, Reference
3+
4+
def process_workbook(filename):
5+
wb = xl.load_workbook(filename)
6+
sheet = wb ["Sheet1"]
7+
8+
9+
for row in range(2, sheet.max_row + 1):
10+
cell = sheet.cell(row, 3)
11+
corrected_price = cell.value * 0.9
12+
corrected_price_cell = sheet.cell(row, 4)
13+
corrected_price_cell.value = corrected_price
14+
15+
values = Reference(sheet,
16+
min_row=2,
17+
max_row=sheet.max_row,
18+
min_col=4,
19+
max_col=4)
20+
21+
chart = BarChart()
22+
chart.add_data(values)
23+
sheet.add_chart(chart, 'e2')
24+
25+
wb.save(filename)
26+
27+
28+

car(loop).py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
command = ""
2+
started = False
3+
while True:
4+
command = input("> ").lower()
5+
if command == "start":
6+
if started == True:
7+
print("The car has already started!")
8+
else:
9+
started = True
10+
print("Car started...")
11+
elif command == "stop":
12+
if not started:
13+
print("The car has already stopped!")
14+
else:
15+
started = False
16+
print("Car stopped.")
17+
elif command == "help":
18+
print("""
19+
start - to start the car
20+
stop - to stop the car
21+
quit - to quit
22+
""")
23+
elif command == "quit":
24+
print("Goodbye!")
25+
break
26+
else:
27+
print("Sorry, I don't understand that!")

class_init.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Point:
2+
def __init__(self, x, y):
3+
self.x = x
4+
self.y = y
5+
6+
def move(self):
7+
print("move")
8+
9+
def draw(self):
10+
print("draw")
11+
12+
13+
point = Point(10, 20)
14+
point.x = 11
15+
print(point)

class_mammal_example.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Mammal:
2+
def walk(self):
3+
print("walk")
4+
5+
6+
class Dog(Mammal):
7+
def bark(self):
8+
print("bark")
9+
10+
11+
class Cat(Mammal):
12+
def be_annoying(self):
13+
print("annoying")
14+
15+
cat1 = Cat()
16+
print (cat1)
17+
18+

class_names_practice.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Person:
2+
def __init__(self, name):
3+
self.name = name
4+
def talk(self):
5+
print(f"Hi, I am {self.name}")
6+
7+
8+
john = Person("Taena mo Janber")
9+
john.talk()
10+
bob = Person("Bob Smith")
11+
bob.talk()

converters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def lbs_to_kg(weight):
2+
return weight * 0.45
3+
4+
5+
def kg_to_lbs(weight):
6+
return weight / 0.45

0 commit comments

Comments
 (0)