Skip to content

Commit 77f274c

Browse files
Add project files.
1 parent d48846f commit 77f274c

28 files changed

+656
-0
lines changed

PythonApplication1/.idea/.idea.PythonApplication1.dir/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PythonApplication1/.idea/.idea.PythonApplication1.dir/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PythonApplication1/.idea/.idea.PythonApplication1.dir/.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PythonApplication1/.idea/.idea.PythonApplication1.dir/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Read schena from database created in sqlalchemy_example.py
3+
#
4+
import sqlalchemy as db
5+
6+
engine = db.create_engine('sqlite:///C:\\Work\\school.db')
7+
connection = engine.connect()
8+
metadata = db.MetaData()
9+
students = db.Table('Student', metadata, autoload=True, autoload_with=engine)
10+
11+
print(students.columns.keys())
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Create simple database under C:\Work - does not create the folder so you mus
3+
#
4+
from sqlalchemy import create_engine
5+
from sqlalchemy import Column, Integer, String
6+
from sqlalchemy.ext.declarative import declarative_base
7+
8+
engine = create_engine('sqlite:///C:\\Work\\school.db', echo=True)
9+
Base = declarative_base()
10+
11+
12+
class School(Base):
13+
14+
__tablename__ = "Student"
15+
16+
id = Column(Integer, primary_key=True)
17+
name = Column(String)
18+
19+
20+
def __init__(self, name):
21+
22+
self.name = name
23+
24+
25+
Base.metadata.create_all(engine)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
class Room:
2+
length = 0.0
3+
breadth = 0.0
4+
5+
# method to calculate area
6+
def calculate_area(self):
7+
print("Area of Room =", self.length * self.breadth)
8+
# simple if-else
9+
def IfExample(self):
10+
if self.length > 0:
11+
print(f'Length is {self.length}')
12+
else:
13+
print("Length is zero")
14+
15+
16+
class Sample1(object):
17+
18+
def IterateArrayWithIndex():
19+
20+
presidentsLastNames = [
21+
"Washington",
22+
"Adams",
23+
"Jefferson",
24+
"Madison",
25+
"Monroe",
26+
"Adams",
27+
"Jackson"
28+
]
29+
30+
for index in range(len(presidentsLastNames)):
31+
print("President {}: {}".format(
32+
index + 1,
33+
presidentsLastNames[index]))
34+
35+
36+
37+
def IterateArray():
38+
languages = ['C#', 'Python', 'Go', 'JavaScript' ]
39+
40+
# access items of a list using for loop
41+
for language in languages:
42+
print(language)
43+
44+
# End of class
45+
46+
class Character:
47+
def __init__(self, Name): #self is the current instance
48+
self.name=Name #set the variable on the instance so that every instance of Character has a name
49+
50+
def getName(self):
51+
return self.name #refer to the name with the instance
52+
53+
54+
55+

PythonApplication1/LinesFile.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Line 1
2+
Line 2
3+
Line 3
4+
Line 22
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Person():
2+
def __init__(self, firstName, lastName):
3+
self.FirstName = firstName
4+
self.LastName = lastName
5+
6+
7+
8+
9+
10+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Taxpayer:
2+
"""description of class"""
3+
Id = 0
4+
FirstName = ""
5+
LastName = ""
6+
Pin = 0
7+
8+

0 commit comments

Comments
 (0)