From f89f040ec2e3f4e2c838c80e748600bd7cbe05af Mon Sep 17 00:00:00 2001 From: ANKIT KUNDU <53438946+Ankit12453@users.noreply.github.com> Date: Sun, 17 Oct 2021 10:06:09 +0530 Subject: [PATCH 1/3] Update python-code-bunch.py --- python-code-bunch.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python-code-bunch.py b/python-code-bunch.py index d8704d4..9bbf351 100644 --- a/python-code-bunch.py +++ b/python-code-bunch.py @@ -12,7 +12,6 @@ #Q2: CHECK EVEN NUMBERS BETWEEN CERTAIN RANGE OF VALUE #SOLUTION : - def check(x): if(x % 2 == 0 or x % 4 == 0): return x @@ -41,3 +40,11 @@ def sod(x,y): print("Sum of digits value is : ") print(functools.reduce(sod, list)) +#Q5: #Swap elements based on position: +#SOLUTION : + +list=[62,12,8,76] +def newlist(list): + list[1],list[2]= list[2], list[1] + return list +print(newlist(list)) From 85e7ef3fa48b0533b7e0e2fc1b7e657959c04f4f Mon Sep 17 00:00:00 2001 From: ANKIT KUNDU <53438946+Ankit12453@users.noreply.github.com> Date: Thu, 11 Aug 2022 13:07:43 +0530 Subject: [PATCH 2/3] helmet.py --- helmet.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 helmet.py diff --git a/helmet.py b/helmet.py new file mode 100644 index 0000000..c97c153 --- /dev/null +++ b/helmet.py @@ -0,0 +1,47 @@ +import turtle + +ankur1 = [[(-40, 120), (-70, 260), (-130, 230), (-170, 200), (-170, 100), (-160, 40), (-170, 10), (-150, -10), (-140, 10), + (-40, -20), (0, -20)], + [(0, -20), (40, -20), (140, 10), (150, -10), (170, 10), (160, 40), (170, 100), (170, 200), (130, 230), (70, 260), + (40, 120), (0, 120)]] +ankur2 = [[(-40, -30), (-50, -40), (-100, -46), (-130, -40), (-176, 0), (-186, -30), (-186, -40), (-120, -170), (-110, -210), + (-80, -230), (-64, -210), (0, -210)], + [(0, -210), (64, -210), (80, -230), (110, -210), (120, -170), (186, -40), (186, -30), (176, 0), (130, -40), + (100, -46), (50, -40), (40, -30), (0, -30)]] +ankur3 = [[(-60, -220), (-80, -240), (-110, -220), (-120, -250), (-90, -280), (-60, -260), (-30, -260), (-20, -250), + (0, -250)], + [(0, -250), (20, -250), (30, -260), (60, -260), (90, -280), (120, -250), (110, -220), (80, -240), (60, -220), + (0, -220)]] + +turtle.hideturtle() +turtle.bgcolor('#ba161e') # Dark Red +turtle.setup(500, 600) +turtle.title("I AM IRONMAN") +ankur1Goto = (0, 120) +ankur2Goto = (0, -30) +ankur3Goto = (0, -220) +turtle.speed(2) + + +def logo(a, b): + turtle.penup() + turtle.goto(b) + turtle.pendown() + turtle.color('#fab104') # Light Yellow + turtle.begin_fill() + + for i in range(len(a[0])): + x, y = a[0][i] + turtle.goto(x, y) + + for i in range(len(a[1])): + x, y = a[1][i] + turtle.goto(x, y) + turtle.end_fill() + + +logo(ankur1, ankur1Goto) +logo(ankur2, ankur2Goto) +logo(ankur3, ankur3Goto) +turtle.hideturtle() +turtle.d From db09a7ded5e0cf4f3b1eb61212eba1cfe6231a08 Mon Sep 17 00:00:00 2001 From: ANKIT KUNDU <53438946+Ankit12453@users.noreply.github.com> Date: Thu, 11 Aug 2022 13:13:41 +0530 Subject: [PATCH 3/3] helmet1.py --- helmet1.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 helmet1.py diff --git a/helmet1.py b/helmet1.py new file mode 100644 index 0000000..c97c153 --- /dev/null +++ b/helmet1.py @@ -0,0 +1,47 @@ +import turtle + +ankur1 = [[(-40, 120), (-70, 260), (-130, 230), (-170, 200), (-170, 100), (-160, 40), (-170, 10), (-150, -10), (-140, 10), + (-40, -20), (0, -20)], + [(0, -20), (40, -20), (140, 10), (150, -10), (170, 10), (160, 40), (170, 100), (170, 200), (130, 230), (70, 260), + (40, 120), (0, 120)]] +ankur2 = [[(-40, -30), (-50, -40), (-100, -46), (-130, -40), (-176, 0), (-186, -30), (-186, -40), (-120, -170), (-110, -210), + (-80, -230), (-64, -210), (0, -210)], + [(0, -210), (64, -210), (80, -230), (110, -210), (120, -170), (186, -40), (186, -30), (176, 0), (130, -40), + (100, -46), (50, -40), (40, -30), (0, -30)]] +ankur3 = [[(-60, -220), (-80, -240), (-110, -220), (-120, -250), (-90, -280), (-60, -260), (-30, -260), (-20, -250), + (0, -250)], + [(0, -250), (20, -250), (30, -260), (60, -260), (90, -280), (120, -250), (110, -220), (80, -240), (60, -220), + (0, -220)]] + +turtle.hideturtle() +turtle.bgcolor('#ba161e') # Dark Red +turtle.setup(500, 600) +turtle.title("I AM IRONMAN") +ankur1Goto = (0, 120) +ankur2Goto = (0, -30) +ankur3Goto = (0, -220) +turtle.speed(2) + + +def logo(a, b): + turtle.penup() + turtle.goto(b) + turtle.pendown() + turtle.color('#fab104') # Light Yellow + turtle.begin_fill() + + for i in range(len(a[0])): + x, y = a[0][i] + turtle.goto(x, y) + + for i in range(len(a[1])): + x, y = a[1][i] + turtle.goto(x, y) + turtle.end_fill() + + +logo(ankur1, ankur1Goto) +logo(ankur2, ankur2Goto) +logo(ankur3, ankur3Goto) +turtle.hideturtle() +turtle.d