Skip to content

Commit d9019b2

Browse files
committed
update
1 parent 8690eb4 commit d9019b2

File tree

5 files changed

+80
-28
lines changed

5 files changed

+80
-28
lines changed

04-Print.py

+23-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
author : Jaydatt
33
print function
44
'''
5+
print('-------------1-----------------')
56
print('Hello" World !' , 2023 )
67
print("Hello ' World !")
78
print("""" Hello "
@@ -12,24 +13,41 @@
1213
print('float : ',3.14)
1314
print("2**3 :",2**3)
1415

15-
course = "Python"
16-
year = 2023
16+
print('-------------2-----------------')
17+
18+
x = 2
19+
y = 6
20+
print(f'sum of {x} and {y} is {x+y}; product: {x*y}.')
1721

1822
'''
1923
(string with {}....).format(ele1,ele2,.....)
2024
For two decimal places, put :.2f
2125
'''
22-
print("Welcome to {} in {}.".format(course,year))
2326

24-
x = 2
25-
y = 6
2627
print('sum of {} and {} is {}; product: {}.'.format( x, y, x+y, x*y))
2728

29+
print('-------------3-----------------')
30+
2831
val = 3.145131
2932
print("Pi : {:.2f}".format(val))
33+
print('-------------4-----------------')
3034

3135
names = ["Alexey", "Catalina", "Misuki", "Pablo"]
3236

3337
print("'{first}!' she yelled. 'Come here, {first}! {f_one}, {f_two}, and {f_three} are here!'".format(f_three = names[3], first = names[1], f_one = names[0], f_two = names[2]))
3438

3539
# error : 'The set is {​{​{}, {}​}​}.'.format(a, b)
40+
41+
print('-------------5-----------------')
42+
43+
# %d for signed decimal numbers
44+
# %u for unsigned decimal numbers
45+
# %c for characters
46+
# %f for floating-point real numbers
47+
# %s for strings
48+
string = 'Welcome'
49+
year = 2024
50+
print('%s Python %d'%(string, year))
51+
print('Python %c'%(year))
52+
print('Python %u'%(year))
53+
print('Python %f'%(year))

22-String.py

+45-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,46 @@
1-
# string
1+
'''
2+
author : Jaydatt
3+
string
4+
'''
25

3-
# Joint strings............
6+
x = 2
7+
y = 6
8+
print(f'sum of {x} and {y} is {x+y}; product: {x*y}.')
9+
10+
'''
11+
(string with {}....).format(ele1,ele2,.....)
12+
For two decimal places, put :.2f
13+
'''
14+
15+
print('sum of {} and {} is {}; product: {}.'.format( x, y, x+y, x*y))
16+
17+
18+
19+
val = 3.145131
20+
print("Pi : {:.2f}".format(val))
21+
22+
23+
names = ["Alexey", "Catalina", "Misuki", "Pablo"]
24+
25+
print("'{first}!' she yelled. 'Come here, {first}! {f_one}, {f_two}, and {f_three} are here!'".format(f_three = names[3], first = names[1], f_one = names[0], f_two = names[2]))
26+
27+
# error : 'The set is {​{​{}, {}​}​}.'.format(a, b)
428

29+
30+
# %d for signed decimal numbers
31+
# %u for unsigned decimal numbers
32+
# %c for characters
33+
# %f for floating-point real numbers
34+
# %s for strings
35+
string = 'Welcome'
36+
year = 2024
37+
print('%s Python %d'%(string, year))
38+
print('Python %c'%(year))
39+
print('Python %u'%(year))
40+
print('Python %f'%(year))
41+
42+
43+
# Joint strings............
544
a = "Welcome to "
645
b = 'World'
746
print("concate:",a+b)
@@ -85,6 +124,10 @@
85124
str_s10 = " Hello World ! "
86125
print("\nstr_s10.strip() : ",str_s10.strip())
87126

127+
#using partition() method
128+
str_s11 = 'I loved the show'
129+
print("str_s11.partition('the') : ",str_s11.partition('the'))
130+
88131
# comparison of value
89132
a = "banana"
90133
b = "banana"
@@ -95,21 +138,3 @@
95138
print("id(a) : ",id(a))
96139
print("id(b) : ",id(b))
97140

98-
'''
99-
(string with {}....).format(ele1,ele2,.....)
100-
For two decimal places, put :.2f
101-
'''
102-
course = "python"
103-
year = 2024
104-
print("Welcome to {} in {}.".format(course,year))
105-
106-
x = 2
107-
y = 6
108-
print('sum of {} and {} is {}; product: {}.'.format( x, y, x+y, x*y))
109-
110-
val = 3.145131
111-
print("Pi : {:.2f}".format(val))
112-
113-
names = ["Alexey", "Catalina", "Misuki", "Pablo"]
114-
115-
print("'{first}!' she yelled. 'Come here, {first}! {f_one}, {f_two}, and {f_three} are here!'".format( f_three = names[3], first = names[1], f_one = names[0], f_two = names[2]))

23-String_escap.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Escap sequences
1+
'''
2+
author : Jaydatt
3+
string Escap sequences
4+
'''
25
# \n = new line
36
# \t = horizontal tab
47
# \v = vertical tab

26-Loop_Break_continue.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
'''
2+
author : Jaydatt
3+
Loops with break and continue
4+
'''
15
print("for loop break :-------")
26
for i in range(10):
37
print(i)

44-Decorators.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# Author : Jaydatt Patel
2-
# Decorators: In Python, decorators are a powerful feature that allows you to modify the behavior of a function or a method. They are a type of higher-order function, meaning they take a function as an argument and return a new function that can enhance or alter the behavior of the original function.
1+
'''
2+
Author : Jaydatt Patel
3+
Decorators: In Python, decorators are a powerful feature that allows you to modify the behavior of a function or a method. They are a type of higher-order function, meaning they take a function as an argument and return a new function that can enhance or alter the behavior of the original function.
4+
'''
35

46

57
# defining decorator and its wrapper function

0 commit comments

Comments
 (0)