Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pandas as pd

df = pd.read_excel("Iterator-Lab.xlsx", sheet_name= 0,index_col = 0)
print(df)

list_Device = list(df["Device"])
list_Current = list(df["Current"])
list_Power = list(df["Power"])
print(list_Device)
print(list_Current)
print(list_Power)

sorted_list_Power = sorted(list_Power, reverse = True)
print(sorted_list_Power[0], sorted_list_Power[1])

index_1 = list_Power.index(sorted_list_Power[0])
index_2 = list_Power.index(sorted_list_Power[1])
print(index_1, index_2)

print("Top two power rating Devices are ", list_Device[index_1], ' ', list_Device[index_2])
print("Top two power rated Current readings are ", list_Current[index_1], ' ', list_Current[index_2])
print("Top two Power ratings are ", list_Power[index_1], ' ', list_Power[index_2])

iterator_list_Power = iter(list_Power)

print("\n Iterarte Power \n")
while True:
try:
print(next(iterator_list_Power))
except StopIteration:
break
print("\n Iterarte Current \n")
iterator_list_Current = iter(list_Current)
for cur in iterator_list_Current:
print(iterator_list_Current.__next__())
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import datetime
import openpyxl

def check_valid_date(y, m, d):
correctDate = None
try:
newDate = datetime.datetime(y, m, d)
correctDate = "Valid Date"
myfile = openpyxl.load_workbook("event.xlsx")
sheet = myfile.get_sheet_by_name("Sheet1")
sheet['A2'] = "My BirthDay"
event_date = str(y) + '-' +str(m) + '-' + str(d)
print(event_date)
sheet['B2'] = event_date
myfile.save('event.xlsx')
except ValueError:
correctDate = "Invalid Date"
return correctDate

day = int(input("Enter a day: "))
month = int(input("Enter a month: "))
year = int(input("Enter a year: "))
print(check_valid_date(year, month, day))
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Card(rank=2, suit='clubs')
Card(rank=3, suit='clubs')
Card(rank=4, suit='clubs')
Card(rank=5, suit='clubs')
Card(rank=6, suit='clubs')
Card(rank=7, suit='clubs')
Card(rank=8, suit='clubs')
Card(rank=9, suit='clubs')
Card(rank=10, suit='clubs')
Card(rank='J', suit='clubs')
Card(rank='Q', suit='clubs')
Card(rank='K', suit='clubs')
Card(rank='A', suit='clubs')
Card(rank=2, suit='diamonds')
Card(rank=3, suit='diamonds')
Card(rank=4, suit='diamonds')
Card(rank=5, suit='diamonds')
Card(rank=6, suit='diamonds')
Card(rank=7, suit='diamonds')
Card(rank=8, suit='diamonds')
Card(rank=9, suit='diamonds')
Card(rank=10, suit='diamonds')
Card(rank='J', suit='diamonds')
Card(rank='Q', suit='diamonds')
Card(rank='K', suit='diamonds')
Card(rank='A', suit='diamonds')
Card(rank=2, suit='hearts')
Card(rank=3, suit='hearts')
Card(rank=4, suit='hearts')
Card(rank=5, suit='hearts')
Card(rank=6, suit='hearts')
Card(rank=7, suit='hearts')
Card(rank=8, suit='hearts')
Card(rank=9, suit='hearts')
Card(rank=10, suit='hearts')
Card(rank='J', suit='hearts')
Card(rank='Q', suit='hearts')
Card(rank='K', suit='hearts')
Card(rank='A', suit='hearts')
Card(rank=2, suit='spades')
Card(rank=3, suit='spades')
Card(rank=4, suit='spades')
Card(rank=5, suit='spades')
Card(rank=6, suit='spades')
Card(rank=7, suit='spades')
Card(rank=8, suit='spades')
Card(rank=9, suit='spades')
Card(rank=10, suit='spades')
Card(rank='J', suit='spades')
Card(rank='Q', suit='spades')
Card(rank='K', suit='spades')
Card(rank='A', suit='spades')