-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.py
More file actions
631 lines (556 loc) · 12 KB
/
print.py
File metadata and controls
631 lines (556 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# birth_year = input("What is your Birth Year? ")
# # color = input("What is your favourite colour? ")
# print(type(birth_year))
# age = 2020 - int(birth_year)
# print(type(age))
# print(age)
# weight = input("What is your weight ")
#
# convert_weight = int(weight) * 1000
# print_data = "Your weight is " + str(convert_weight) + " grams"
# print(print_data)
# data = 'shubham dave'
#
# print(data[-1:0])
# Formatted string (06/03/2020)
# first = 'Shubham'
# last = 'Dave'
#
# msg = f'{first} [{last}] is a developer'
#
# print (msg)
# String Methods
# course = "Shubham dave is my name"
# print (len(course))
# print(course.upper())
# print(course)
# print(course.lower())
# print(course.find('n'))
# print(course.replace('name', 'pet name'))
# print(course.title())
# print('Shubham' in course)
# Arithmetic operator
# x = 20
# x *= 2
# print(x)
# Operator Precedence
# x = 10 + 2 * 3
# print(x)
# precedence
# parenthesis -> (a -b)
# exponential -> 2 ** 3
# multiplication or division -> a/b or a*b
# addition or substraction -> a+b or a-b
# math module ke baare me padhna hai python ke site se
# if else statement case
# is_hot = False
# is_cold = False
# data = input("what type of day it is")
# if 'hot' in data:
# is_hot = True
# is_cold = False
# elif "cold" in data:
# is_hot = False
# is_cold = True
# else:
# is_hot = False
# is_cold = False
#
# if is_hot:
# print("Its a hot day")
# print("Drink plenty of water")
# elif is_cold:
# print("Its a cold day")
# print("Wear hot clothes")
# else:
# print("Its a Lovely day")
# price = 1000000
# good_credit = False
#
# if good_credit:
# msg = f'Amount to be paid = ${(price *10 / 100)}'
# # print(msg)
# else:
# msg = f'Amount to be paid = ${(price * 20 / 100)}'
#
# print(msg)
# Logical OPerators
# has_high_income = True
# has_good_credit = False
# if has_good_credit and has_high_income:
# print('loan can be granted')
# elif has_high_income and not not not has_good_credit:
# print('half loan can be granted')
# else:
# print("loan can't be granted")
# and
# or
# not
# Comparison Operator
# name = input("write your name here ")
#
# if len(name) < 3:
# print("name length should be greater than 3 char")
# elif len(name) > 50:
# print("name length should be lesser than 50 char")
# else:
# print("name looks good")
# Weight Convertor Program
# weight = input("Weight: ")
# weight_value = input("(K)g or (G)rams: ")
# print(weight_value)
# print(bool('k' in weight_value))
# if weight_value.upper() == 'K':
# data = int(weight) * 1000
# print(f'You are {data} grams')
# elif weight_value.upper() == 'G':
# data = int(weight) / 1000
# print(f'You are {data} kilograms')
# else:
# print(f'Please put data correctly')
# print(msg)
# date 10/03/2020
# While Loops
# i = 1
# while i <= 5:
# print("*" * i)
# i += 1
# print("done")
# Guess Game
# guess_number = 17
#
# user_number = 0
# user_limit = 3
#
# while user_number < user_limit:
# user_guess_number = int(input('Guess: '))
# user_number += 1
# if user_guess_number == guess_number:
# print('You won!')
# break
# else:
# print('you failed!')
# Car Game
# data = input(">")
# # print(data.upper())
# if data.lower() == 'help':
# print("""
# start - to start the car
# stop - to stop the car
# quit - to exit
# """)
# elif data.lower() == "start":
# print('car started... ready to go')
# elif data.lower() == "stop":
# print('car stopped.')
# elif data.lower() == "quit":
# print("quited")
# else:
# print('i can not understand')
# command = ""
# start = False
# # stop = False
# while True:
# command = input("> ").lower()
# if command == "start":
#
# if start:
# print("car is already started what are you doing")
# else:
# start = True
# print("Car Started!")
# elif command == "stop":
# if not start:
# print("car is already Stopped what are you doing")
# else:
# start = False
# print("Car Stopped!")
# elif command == "help":
# print("""
# start - to start the car
# stop - to stop the car
# quit - to quit the game
# """)
# elif command == "quit":
# break
# else:
# print("I don't understand that")
# # else:
# # print("quited")
# for item in 'Python':
# print(item)
# for item in range(8, 81, 8):
# print(item)
# prices = [10, 20, 30]
# total = 0
# for item in prices:
# total += item
# print(f"Total: {total}")
# for x in range(4):
# for y in range(3):
# if x == y:
# print(f"when data is same")
# print(f"({x} , {y})")
# else:
# print(f"when data is not same")
# print(f"({x}, {y})")
# challenge
# numbers = [5, 2, 5, 2, 2]
#
# for item in numbers:
# # print('X' * item)
# output = ''
# for i in range(item):
# output += 'F'
# print(output)
# Lists Tutorials
# to find largest number in list
# listData = [2, 3, 17, 5, 10]
#
# # for data in range(len(listData)):
# largest = listData[0]
# for data in listData:
# # data = int(data)
# # print(type(data))
# # value_1 = data
# if data > largest:
# largest = data
# # elif largest > data:
# # largest = data
# print(largest)
# # 2d lists
# matrix = [
# [1, 2, 3],
# [4, 5, 6],
# [7, 8, 9]
# ]
#
# matrix[1][1] = 17
# for row in matrix:
# for column in row:
# print(column)
# print(matrix)
# # List methods
# numbers = [1, 5, 2, 7, 4, 1]
# new_numbers = []
# numbers.append(20)
# numbers.insert(0, 25)
# numbers.remove(5)
# numbers.clear()
# numbers.pop()
# print(7 in numbers)
# print(numbers.index(1))
# number2 = numbers.copy()
# number2.sort()
# numbers.reverse()
# print(f'''
# Real Value: {numbers}
# New Value : {number2}
# ''')
# for item in numbers:
# if item not in new_numbers:
# new_numbers.append(item)
# print(new_numbers)
# # Tupels:
# numbers = (1, 2, 3)
# numbers[0] = 1
# print(numbers[0])
# x, y, z = numbers
# numbers.__contains__()
# print(numbers.__add__())
# # Dictonary
# customer = {
# "name" : "Shubham Dave",
# 'age' : '20',
# "mail" : 'shubham.dave@gmail.com'
# }
# customer["name"] = "shivang dave"
# print(customer.get("birthdarte", "01 Aug 1996"))
# character = input("Write number here to see in alphabets")
# number_mapping = {
# "1" : "one",
# "2" : "two",
# "3" : "three",
# "4" : "four",
# "5" : "five",
# "6" : "six",
# "7" : "seven",
# "8" : 'eight',
# "9" : "nine"
# }
# output = ""
# for ch in character:
# output += number_mapping.get(ch, "!") + " "
# print(output)
# # Emojis Function
# message = input(">")
# words = message.split(' ')
# # print(words)
# emojis = {
# ":)" : "😀",
# ":(" : "😥",
# ";)" : "😎"
# }
# output = ""
#
# for word in words:
# output += emojis.get(word, word) + " "
# print(output)
# # Function in python
#
#
# def greet_user():
# print("hey there")
# print("welcome to group")
#
#
# print("Start")
# greet_user()
# print("End")
# # function using keyword argument and positional argument
#
# def greet_user(first_name, last_name):
# print(f"hey {first_name} {last_name}")
# print("welcome to group")
#
#
# print("Start")
# greet_user("shubham", last_name="dave")
# print("End")
# # Return statement
#
#
# def square(num):
# return num * num
#
#
# def cube(number):
# return number * square(number)
#
#
# print(cube(10))
# # Reusable Function
# def emoji_converter(message):
# words = message.split(' ')
# emojis = {
# ":)" : "😀",
# ":(" : "😥",
# ";)" : "😎"
# }
# output = ""
#
# for word in words:
# output += emojis.get(word, word) + " "
# return output
#
#
# message = input("=>")
#
# print(emoji_converter(message))
# # Debugging
# try:
# age = int(input('Age: '))
# print(age)
# income = 20000
# risk = income/age
# print(risk)
# except ZeroDivisionError:
# print("Age cannot be 0.")
# except ValueError:
# print("Invalid Input")
# # Comment
# # Do not use for what always why and how
# # Classes
# class Points:
#
# def move(self):
# print("move")
#
# def draw(self):
# print("draw")
#
#
# point1 = Points()
# point1.x = 1
# point1.y = 2
# print(point1.x)
# print(point1.y)
#
# point1.move()
# point1.draw()
#
# point2 = Points()
# point2.move()
# point2.draw()
# # Constructor
# class Point:
# def __init__(self, x, y):
# self.x = x
# self.y = y
#
# def draw(self, x, y):
# print(f"Draw {x,y}")
#
# def move(self, x, y):
# print(f"Move {x,y}")
#
#
# point = Point(10, 20)
# print(f"({point.x}, {point.y})")
# point.draw(5, 7)
# point.move(15, 20)
# # Question
# class Person:
# def __init__(self, name):
# self.name = name
# print(f"Hello I am {self.name}")
#
# def talk(self):
# print(f"Hi I am {self.name}")
#
#
# person = Person("Shubham dave")
# person.talk()
#
#
# ashu = Person("Ashutosh Dave")
# ashu.talk()
# num = (input("=>"))
#
# data = num.split(",")
#
# total_no_peaks = 0
# base_value = int(data[0])
# for value in data:
# value = int(value)
# new_value = value
# if value > base_value:
# base_value = value
# if base_value <= new_value:
# print(value, base_value, new_value)
# total_no_peaks = total_no_peaks + 1
# print(total_no_peaks)
# # Code Jam Question
# base = int(input())
#
#
# def total_no(args):
# return print(args)
#
#
# # num = int(input("=>"))
#
# # data = num.split(",")
# total_no_peaks = 0
#
#
# def cal_data(value):
# # data = input()
#
# # for i in range(0, data):
#
# peak = input()
# peak_value = peak.split()
# print(peak_value)
# base_value = int(peak_value[0])
# for i in peak_value:
# i = int(i)
# if i > base_value:
# base_value = i
# # total_no += 1
# total_no(1)
# # print(total_no)
# elif i < base_value:
# i = i
#
#
# # print(total_no)
#
# for i in range(0, base):
# cal_data(i)
# # Inheritance
#
# class Mammal:
# def walk(self, name):
# print(f"{name} walk")
#
#
# class Dog(Mammal):
# def bark(self, name):
# print(f"{name} bark")
#
#
# class Cat(Mammal):
# def meow(self, name):
# print(f"{name} meow")
#
#
# dog1 = Dog()
# dog1.walk("dog")
# dog1.bark("dog")
#
# cat1 = Cat()
# cat1.walk("pussy")
# cat1.meow("pussy")
# # Modules
# from convertor import find_max
#
# value = input("Input value to find max => ")
#
# print(find_max(value))
# # Packages
# from ecommerece import shipping
#
# shipping.cal_shipping()
# shipping.cal_tax()
# # System Module
import random
# class Dice:
# def roll(self):
# first = random.randint(1, 6)
# second = random.randint(1, 6)
# return first, second
#
#
# dice = Dice()
# # print(f"({dice.roll()}, {dice.roll()})")
# print(dice.roll())
# members = ['shivang', 'shubham', 'hemant']
# members = input("write the memebers name to find leader=> ")
# members_list = members.split()
# for i in members_list:
# leader = random.choice(members_list)
# print(leader)
# # Files and Directories
# from pathlib import Path
#
# path = Path()
# for file in path.glob('*'):
# print(file)
# path.rmdir()
# print(path.exists())
# # PyPI and Pip
# different types of module to work on using PyPI
# get those data from PyPI and work on it
import openpyxl as xl
from openpyxl.chart import BarChart, Reference
wb = xl.load_workbook('transactions.xlsx')
sheet = wb['Sheet1']
cell = sheet.cell(2, 1)
for row in range(2, sheet.max_row + 1):
cell = sheet.cell(row, 3)
corrected_price = cell.value + (cell.value * 0.09)
corrected_price_cell = sheet.cell(row, 4)
corrected_price_cell.value = corrected_price
# values = Reference(sheet,
# min_row=2,
# max_row=sheet.max_row,
# min_col=4,
# max_col=4)
#
# chart = BarChart()
# chart.add_data(values)
#
# sheet.add_chart(values, 'e2')
wb.save('transactions2.xlsx')
# video 03:44:00 tak hua