Skip to content

Commit a2247d6

Browse files
committed
learning python
1 parent 3b34fcf commit a2247d6

Some content is hidden

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

46 files changed

+1051
-7
lines changed

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/Learning_Python.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Type_Conversion.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
age = input("what is your age ? ");
2+
3+
new_age = int(age) + 2;
4+
5+
6+
print("your age after two year is " + str(new_age));

__pycache__/string.cpython-311.pyc

764 Bytes
Binary file not shown.

arthematic_operators.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
print(5+10);
2+
3+
print(10-5);
4+
5+
print(3*3);
6+
7+
print(2/5);
8+
9+
print(2 // 5);
10+
11+
print(4%3);
12+
13+
print(5 ** 2);
14+
15+
i = 5;
16+
17+
i += 2;
18+
19+
print(i);
20+
21+

break_continue.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
list = [1,4,5,7,82,10];
4+
5+
for el in list:
6+
if el >= 30:
7+
break;
8+
print(el);
9+
10+
11+
12+
13+

comments_in_python.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# her is the first comment
2+
3+
4+
# taking input input
5+
f = input("first number ");
6+
s = input("second number ");
7+
8+
# calculating the sum
9+
# we have to do type conversion becuase
10+
# by defualt in python it take all things in string format
11+
sum = int(f)+int(s);
12+
13+
# printing the sum
14+
print(sum);
15+

comparison_operators.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
3+
print(3 > 2);
4+
5+
print(3 < 2);
6+
7+
print(3 <= 2);
8+
9+
print(3 >= 2);
10+
11+
print(3 == 2);
12+
13+
print(3 == 3);
14+
15+
print(3 != 2);
16+
17+
print(3 > 2 or 3 < 2);
18+
19+
print(3 > 2 and 3 < 2);
20+
21+
print(not 2 > 3);
22+
23+
24+
25+

conditional_statement.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
age = 18;
2+
3+
if age > 18:
4+
print("Eligible for vote");
5+
elif age == 18:
6+
print("welcome eligible for vote");
7+
else :
8+
print("Not eligible for vote");

dattype.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name = "Shubham"
2+
age = 23
3+
hieght = 224.0
4+
Indian = True
5+
6+
name = "Bhati"
7+
age = 21
8+
9+
10+
print(name)
11+
print(hieght)
12+
print(Indian)
13+
print(age)
14+
15+
person = "Tony Stark"
16+
age = 51
17+
is_genius = True
18+
19+
name = input("Name")

disctionary.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
student = {
4+
"marks" : 70,
5+
"city" : "Ujjain",
6+
"Course" : "Java Backend Development"
7+
8+
}
9+
student["state"] = "Madhya Pradesh"
10+
11+
12+
print(student["marks"])
13+
print(student)

fileIo.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
intro = "My name is Shubham Bhati. I am from Ujjain(M.P)"
4+
5+
with open("intro.txt","w") as h:
6+
h.write(intro)
7+
8+
9+
with open("intro.txt","r") as j:
10+
g = j.read()
11+
print(g)

firstProgram.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello World")

for_loop.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
for i in range(10):
4+
print(i);

for_loop_2.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import sys
2+
3+
# for i in range(6):
4+
# print(i)
5+
6+
7+
set = {1,2,3,8,39,103,7,29,49,9}
8+
9+
10+
list = [1,39,0,30,20,40,192,503,5]
11+
12+
dist = {1:"Shubham",
13+
2:"Aman",
14+
3:"Chinmay",
15+
4:"Vivek"
16+
}
17+
18+
19+
l = len(dist)
20+
21+
print(l)
22+
23+
for i in range(len(dist)):
24+
print(dist.get(i+1))
25+
26+
27+
t = (1,3,5,6,8,9,0)
28+
29+
for i in t:
30+
print(i)
31+
print("----------------")
32+
s = {1,2,2,3,3,4,5,5,6,3,2,2,6}
33+
34+
for j in s:
35+
print(j)

function_2.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def print_sum(f,s):
2+
print(f+s);
3+
4+
5+
6+
print_sum(2,5);
7+
8+
9+
def print_sum_2(f,s=4):
10+
print(f+s);
11+
12+
print_sum_2(6);
13+

functions.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
def sayHello(name):
3+
print("Hello "+name)
4+
5+
6+
7+
sayHello("Shubham")
8+
9+
10+
def table(num):
11+
for i in range(11):
12+
print(str(num) + " * " + str(i+1) + " = " + str((i+1) * num))
13+
14+
print("------------")
15+
16+
table(6)
17+
18+
table(4)

funstions.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import math
2+
3+
4+
print(dir(math))
5+
6+
7+
8+
def greeting(name):
9+
print("hello "+name);
10+
11+
12+
13+
greeting("shubham");

ifelse_ladder.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
age = int(input("Enter your age : "))
4+
5+
6+
if(age <= 0):
7+
print("Invalid age")
8+
elif(age <= 10):
9+
print("kid")
10+
elif(age <= 16):
11+
print("teen")
12+
elif(age <= 18):
13+
print("boy")
14+
else:
15+
print("Matured")
16+
17+
18+

input_taking.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name = input("What is your name ? ")
2+
age = input("Your age ? ")
3+
city = input("City ? ")
4+
5+
print("Name is "+name);
6+
print("Age is "+age);
7+
print("City is "+city);

intro.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
My name is Shubham Bhati. I am from Ujjain(M.P)

list.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
list = [23,26,2,5,10,39];
2+
3+
4+
print((list))
5+
6+
print(list[3]);
7+
8+
print(list[-1]);
9+
10+
print(list[0:3]);
11+
12+
for s in list:
13+
print(s);
14+
15+
list.append(5);
16+
17+
list.insert(0,100);
18+
19+
print(100 in list);
20+
21+
print(900 in list)
22+
23+
print((len(list)));
24+
25+
print(list)
26+
27+
28+
i = 0;
29+
30+
while i < len(list):
31+
print(list[i]);
32+
i+=1
33+
34+
35+
36+
37+

listandMethods.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
l1 = [1,5,7,1,8,20,"Shubham",4,5,7,5]
4+
5+
print(l1)
6+
l1.remove('Shubham')
7+
8+
print(l1)
9+
10+
print(l1.count(5))
11+
12+
13+
print(l1.sort())
14+
l1.append("last")
15+
16+
17+
print(l1)

loop.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
i = 1;
4+
5+
while i <= 10:
6+
print(i);
7+
i+=1;

0 commit comments

Comments
 (0)