Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9496d30

Browse files
long pending commits
1 parent fb94b2a commit 9496d30

File tree

85 files changed

+2074
-552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2074
-552
lines changed

‎.vscode/launch.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File (Integrated Terminal)",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal"
13+
},
14+
{
15+
"name": "Python: Remote Attach",
16+
"type": "python",
17+
"request": "attach",
18+
"port": 5678,
19+
"host": "localhost",
20+
"pathMappings": [
21+
{
22+
"localRoot": "${workspaceFolder}",
23+
"remoteRoot": "."
24+
}
25+
]
26+
},
27+
{
28+
"name": "Python: Module",
29+
"type": "python",
30+
"request": "launch",
31+
"module": "enter-your-module-name-here",
32+
"console": "integratedTerminal"
33+
},
34+
{
35+
"name": "Python: Django",
36+
"type": "python",
37+
"request": "launch",
38+
"program": "${workspaceFolder}/manage.py",
39+
"console": "integratedTerminal",
40+
"args": [
41+
"runserver",
42+
"--noreload",
43+
"--nothreading"
44+
],
45+
"django": true
46+
},
47+
{
48+
"name": "Python: Flask",
49+
"type": "python",
50+
"request": "launch",
51+
"module": "flask",
52+
"env": {
53+
"FLASK_APP": "app.py"
54+
},
55+
"args": [
56+
"run",
57+
"--no-debugger",
58+
"--no-reload"
59+
],
60+
"jinja": true
61+
},
62+
{
63+
"name": "Python: Current File (External Terminal)",
64+
"type": "python",
65+
"request": "launch",
66+
"program": "${file}",
67+
"console": "externalTerminal"
68+
}
69+
]
70+
}

‎.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "C:\\Python37\\python.exe"
3+
}

‎ArgsKwArgs/KwArgs.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Example 3: Using **kwargs to pass the variable keyword arguments to the function
2+
def intro(**data):
3+
print("\nData type of argument:",type(data))
4+
5+
for key, value in data.items():
6+
print("{} is {}".format(key,value))
7+
8+
intro(Firstname="Sita", Lastname="Sharma", Age=22, Phone=1234567890)
9+
intro(Firstname="John", Lastname="Wood", Email="johnwood@nomail.com", Country="Wakanda", Age=25, Phone=9876543210)
10+
# When we run the above program, the output will be
11+
12+
# Data type of argument: <class 'dict'>
13+
# Firstname is Sita
14+
# Lastname is Sharma
15+
# Age is 22
16+
# Phone is 1234567890
17+
18+
# Data type of argument: <class 'dict'>
19+
# Firstname is John
20+
# Lastname is Wood
21+
# Email is johnwood@nomail.com
22+
# Country is Wakanda
23+
# Age is 25
24+
# Phone is 9876543210
25+
26+
27+
# In the above program, we have a function intro() with **data as a parameter. We passed two dictionaries with variable argument length to the intro() function. We have for loop inside intro() function which works on the data of passed dictionary and prints the value of the dictionary.
28+
29+
'''
30+
Things to Remember:
31+
1. *args and *kwargs are special keyword which allows function to take variable length argument.
32+
2. *args passes variable number of non-keyworded arguments list and on which operation of the list can be performed.
33+
3. **kwargs passes variable number of keyword arguments dictionary to function on which operation of a dictionary can be performed.
34+
4. *args and **kwargs make the function flexible.
35+
'''

‎Classes/composition.py

Whitespace-only changes.

‎Classes/decorators.py

Whitespace-only changes.

‎Classes/globalVariables.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
3+
import math
4+
5+
6+
7+
class AreaOfCircle():
8+
PI_VALUE = 3.14
9+
10+
def __init__(self, name, gender):
11+
self.name = name
12+
self.gender = gender
13+
14+
def areaCalculation(self, radius):
15+
return 3.14 * (radius**2)
16+
17+
18+
# sampleObj = AreaOfCircle()
19+
20+
# print(sampleObj)
21+
22+
# value = sampleObj.areaCalculation(5)
23+
24+
# print(value)
25+
26+
# what is the class attributes the?
27+
28+
# print(AreaOfCircle.PI_VALUE)
29+
30+
# print(sampleObj.PI_VALUE)
31+
32+
###############
33+
34+
ramObj = AreaOfCircle('Ram', 'Male')
35+
36+
print(ramObj.name)
37+
print(ramObj.gender)
38+
39+
40+
# how about this?
41+
42+
print(AreaOfCircle.name)

‎Classes/inheritance.py

Whitespace-only changes.

‎Classes/session-on-class.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
2+
3+
class Employee():
4+
5+
def __init__(self, name, age):
6+
self.name = name
7+
self.age = age
8+
self.pi = 3.142
9+
10+
# wrong way for gettting employee name from the object.
11+
# def getEmployeeName(self, inputFromUser):
12+
# print("Employee name is ", inputFromUser)
13+
14+
def getNewEmployeeName(self):
15+
print("new employee name is ", self.name)
16+
17+
def getEmployeeAge(self):
18+
print(self.name + "'s age is " + self.age)
19+
20+
import random
21+
22+
class Bank():
23+
def __init__(self, name, age, dob, address):
24+
self.name = name
25+
self.age = age
26+
self.dob = dob
27+
self.address = address
28+
self.accountNumber = random.randint(1,1000)
29+
self.accountBalance = 0
30+
print("Your account got created, " + self.name)
31+
32+
33+
def getCustomerAccountInfo(self):
34+
print("Hello " + self.name)
35+
print("Your account got created, here's your account number " , str(self.accountNumber))
36+
print("Your current balance of your account is ", str(self.accountBalance))
37+
38+
def getMyBirthDate(self):
39+
print('Hello ' + self.name + ' you birthday is ' + self.dob)
40+
41+
42+
ramIsTheCustomer = Bank('Ram', 26, '1/1/2020', 'London')
43+
44+
ramIsTheCustomer.getCustomerAccountInfo()
45+
46+
ramIsTheCustomer.getMyBirthDate()
47+
48+
49+
50+
ram = Employee("Ram")
51+
san = Employee("Sanjay")
52+
53+
print(ram)
54+
print("--------")
55+
# print(ram.getEmployeeName("Ram"))
56+
57+
ram.getNewEmployeeName()
58+
59+
san.getNewEmployeeName()
60+
sanjay.getEmployeeAge()
61+
62+
63+
64+
65+
class EmployeeV2():
66+
def __init__(self, name, age, sex):
67+
self.name = name
68+
self.age = age
69+
self.sex = sex
70+
71+
def getEmployeeName(self):
72+
return("Employee name is " + self.name)

‎Classes/special_class_methods.py

Whitespace-only changes.
273 Bytes
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /