Creating a Command Line Utility In Python | Python Tutorials For Absolute Beginners In Hindi #93

  Рет қаралды 73,871

CodeWithHarry

CodeWithHarry

Күн бұрын

►Source Code + Text Tutorial - www.codewithha...
►Full Python tutorials for absolute beginners (Hindi) playlist - • Python Tutorials For A...
►Click here to subscribe - / @codewithharry
Best Hindi Videos For Learning Programming:
►Learn Python In One Video - • Learn Python In Hindi ...
►Learn JavaScript in One Video - • JavaScript Tutorial
►Learn PHP In One Video - • Learn Php In One Video...
►Machine Learning Using Python - • Machine Learning Tutor...
►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
►Advanced Python Tutorials - • Intermediate/Advanced ...
►Object Oriented Programming In Python - • Object Oriented Progra...
►Python Data Science and Big Data Tutorials - • Python Data Science an...
Follow Me On Social Media
►Website (created using Flask) - www.codewithha...
►Facebook - / codewithharry
►Instagram - / codewithharry
►Personal Facebook A/c - / geekyharis
Twitter - / haris_is_here

Пікірлер: 393
@vatsalsavani5436
@vatsalsavani5436 6 ай бұрын
Thank you harry bhai aapki nayi playlist follow kar raha hu day 85 par hu but ye thik se samajh nahi aaya to yaha aagaya aur ab badhiya tarike se samajh gaya. btw theme kafi badhiya he
@Shauryav-of8co
@Shauryav-of8co 4 ай бұрын
mai bhi
@ffgimmortal8871
@ffgimmortal8871 3 жыл бұрын
5:11 harry bahiya ka emotional blackmail 🤣😝
@DevTewatia-p5q
@DevTewatia-p5q Жыл бұрын
I accept the challenge. thanku sir to teach us like a good friend
@kahlong.s8373
@kahlong.s8373 4 жыл бұрын
#Making a faulty calculator (Ex2) using Commd line util import sys import argparse def clac(args): if args.o=='add': if args.X==56 and args.Y==9: return (77) else: return args.X + args.Y if args.o=='div': if args.X == 56 and args.Y == 6: return (4) else: return args.X / args.Y if args.o=='sub': return args.X - args.Y if args.o=='mul': if args.X==45 and args.Y==3: return (555) else: return args.X * args.Y else: return ("There is nothing to do !") if __name__ == '__main__': parser=argparse.ArgumentParser() parser.add_argument("--X",type=float,default=1.0,help="Please contact Gags") parser.add_argument("--Y",type=float,default=1.0,help="Please contact Gags") parser.add_argument("--o",type=str,default=1.0,help="Please contact Gags") args=parser.parse_args() sys.stdout.write(str(clac(args)))
@vinsmalya
@vinsmalya 2 жыл бұрын
Use elif
@learningwithchand6348
@learningwithchand6348 4 жыл бұрын
Very good theme bhai I learnt almost everything in programming I'm coming from c++ and java script
@sarv4265
@sarv4265 Жыл бұрын
# Faulty Calculator - by creating command line utility # Faulty values: 45*3=555, 56+9=77, 56/6=4 import argparse import sys def Faulty_cal(calculation): if calculation.o == "add": if calculation.a == 56 and calculation.b == 9: return 77 else: return calculation.a + calculation.b elif calculation.o == "sub": return calculation.a - calculation.b elif calculation.o == "mul": if calculation.a == 45 and calculation.b == 3: return 555 else: return calculation.a * calculation.b elif calculation.o == "div": if calculation.a == 56 and calculation.b == 6: return 4 else: return calculation.a / calculation.b if __name__ == '__main__': # object of ArgumentParser class in argparse module file parser = argparse.ArgumentParser() # adding arguments to parser object parser.add_argument("--a", type=float, default=0.0, help="Enter 1st number") parser.add_argument("--b", type=float, default=0.0, help="Enter 1st number") parser.add_argument("--o", type=str, default="add", help="Enter 1st number") # Printing result on console using sys module sys.stdout.write(str(Faulty_cal(parser.parse_args())))
@ramchandrainamdar6742
@ramchandrainamdar6742 5 жыл бұрын
Here is my solution for command prompt utility (Ramchandra Inamdar) (file name : pyutil.py) import argparse import sys # file pyutil.py #Uses the function, namely faultycalc giving following wrong answers # 45*3 = 555, 56 + 9 = 77 and 56/6 = 4 #all other answers correct. def faultycalc(args): if args.x == 45 and args.y == 3 and args.o == 'mul': print('multiplication of num1 and num2 = ', end='' ) return 555 elif args.x == 56 and args.y == 9 and args.o == 'add': print('sum of num1 and num2 = ', end='') return 77 elif args.x == 56 and args.y == 6 and args.o == 'div': print('division of num1 and num2 = ', end='') return 4 else: if args.o == 'add': return args.x + args.y elif args.o == 'sub': print('subtraction of num1 and num2 = ', end='') return args.x - args.y elif args.o == 'mul': print('multiplication of num1 and num2 = ', end='') return args.x * args.y elif args.o == 'div': print('division of num1 and num2 = ', end='') return args.x / args.y elif args.o == 'per': print('remainder of num1 over num2 = ', end='') return args.x % args.y else: print("Error! Please check your input") if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--x', type=float, default=1.0, help="Enter first numberPlease contact Harry") parser.add_argument('--y', type=float, default=3.0, help="Enter second number, Please contact Harry") parser.add_argument('--o', type= str, default = 'add', help=" Please contact Harry") args = parser.parse_args() sys.stdout.write(str(faultycalc(args)))
@leahkahn5303
@leahkahn5303 4 жыл бұрын
Harry bhai, light theme accha hota....kher abhi toh bohot late ho gaya hai...But love your videos...bohot seekhne ko mila hai...I even shared it with my friends to learn from your videos and utilize this break into adding to their skills
@tradinglover64
@tradinglover64 3 жыл бұрын
Here is my solution of faulty claculator using command line utility ------------------------------------------------------------------------------------------------------- Great harry sir , i am Manish Kumar ,very much inspired from you , you really play as my mentor role, a big thanks to you import argparse import sys def Faulty_cal(args): if args.operation == 'add': if args.number1 == 10 and args.number2 == 8: return 55 else: return args.number1 + args.number2 elif args.operation == 'sub': return args.number1 - args.number2 elif args.operation == 'mul': if args.number1 == 45 and args.number2 == 3: return 555 return args.number1 * args.number2 elif args.operation == 'div': if args.number1 == 36 and args.number2 == 6: return 9 return args.number1 / args.number2 elif args.operation == 'power': return args.number1 ** args.number2 elif args.operation == 'modulo': return args.number1 % args.number2 else: print('Unsupported Operation !!!') if __name__ == '__main__': parser = argparse.ArgumentParser(description='This is Faulty Calculator') parser.add_argument("--number1", type= int,default=1.0,help= 'Enter First Number') parser.add_argument("--number2", type= int,default= 1.0,help= 'Enter Second Number') parser.add_argument("--operation", type=str,default= 1.0,help= 'operation', choices=['add','sub','mul', 'div','power','modulo']) args = parser.parse_args() sys.stdout.write(str(Faulty_cal(args)))
@desichokre278
@desichokre278 Жыл бұрын
# Command line utility for faulty calculator import argparse import sys def calc(args): if args.x == 45 and args.y == 3 and args.o == 'mul': return 555 elif args.x == 56 and args.y == 9 and args.o == 'add': return 99 elif args.x == 56 and args.y == 6 and args.o == 'div': return 4 else: if args.o == 'add': return args.x + args.y if args.o == 'mul': return args.x * args.y if args.o == 'sub': return args.x - args.y if args.o == 'div': return args.x / args.y else: return "Something went wrong" if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--x',type = float, default = 1.0, help = "Enter 1st no.") parser.add_argument('--y',type = float, default = 3.0, help = "Enter 2nd no.") parser.add_argument('--o',type = str, default = "add", help = "Utility for calculation") args = parser.parse_args() sys.stdout.write(str(calc(args)))
@aksharasharma1469
@aksharasharma1469 Жыл бұрын
Ye VS code pe kaise krna h.....
@programmerlovers8071
@programmerlovers8071 2 жыл бұрын
I accept the challenge 👍🏻👍🏻🔥.
@PervezAlam1
@PervezAlam1 4 жыл бұрын
for making video this theme is good, Text visibility is clear for Viewers .... comparison to white
@techwithpanwar1507
@techwithpanwar1507 3 жыл бұрын
7:47 you are correct harry bhai.
@ankitasingh728
@ankitasingh728 3 жыл бұрын
Thanks Harry, so much 4 making programming tutorial in hindi
@modisonsbusiness5517
@modisonsbusiness5517 2 жыл бұрын
Bohot mast theme hai bhaiya
@libinTom
@libinTom Жыл бұрын
Thanks millions Harry.
@time-is-dead
@time-is-dead 3 жыл бұрын
Bahut badiya bhaiya
@shabegsinghgill732
@shabegsinghgill732 2 жыл бұрын
harry bhai you are a legend
@mahanaatma910
@mahanaatma910 4 жыл бұрын
thanks harry bahi aakhir kaa pata chala ki kaise multi language me ek program ko likha ja sakta hai
@its_nion
@its_nion 3 жыл бұрын
Thanks a lot harry sir for creating such an amazing playlist❤️
@mayurthorat512
@mayurthorat512 4 жыл бұрын
Really vry nyc try hum log k liye...thnxx harry bhai ✌️👍
@ManishKumar-qq5te
@ManishKumar-qq5te 3 жыл бұрын
Perfect nice teaching sir 💯💯💯
@amanshukla8258
@amanshukla8258 4 жыл бұрын
awesome theme sir...bht late ho gya h but maine abhi hi dekhna shuru kiya tha
@sumeetkumar6778
@sumeetkumar6778 Жыл бұрын
Nice explanation , but the negative scenarios were not covered .Plus if you have so much problem with code formatting/beautify then prefer to use flake8 ;)
@farzeenarshad384
@farzeenarshad384 4 ай бұрын
theme is beautiful😍
@kanishkkumar1287
@kanishkkumar1287 2 жыл бұрын
I am also using this theme Harry Bhai CS
@shrishmishra1175
@shrishmishra1175 3 жыл бұрын
thanks bhai love your video
@digitalcodingwithyashu6557
@digitalcodingwithyashu6557 2 жыл бұрын
great video harry bhai
@payalbhatia5244
@payalbhatia5244 2 жыл бұрын
@Code with Harry. This is not just only for beginners. I am not a beginner but there is a tons of knowledge I learnt
@devanshrathaur
@devanshrathaur 5 жыл бұрын
Theme is looking awesome
@hakhandare
@hakhandare 2 жыл бұрын
Thank you
@TECHNIC-LGEEKS
@TECHNIC-LGEEKS 3 жыл бұрын
good prettyfication 🔥🎉🙏
@sanjaysaha1120
@sanjaysaha1120 3 жыл бұрын
Theme bhut accha hai bhai
@uchiha_adhyut8663
@uchiha_adhyut8663 Жыл бұрын
nice theme harry sensei!
@arunite6704
@arunite6704 4 жыл бұрын
East or west Harry bhai ki theme is best
@kumar.abhinav
@kumar.abhinav 2 жыл бұрын
I really like your videos. Good work bhai !
@ankitchetri2968
@ankitchetri2968 3 жыл бұрын
Thank u bhaiya
@taimoorneutron2940
@taimoorneutron2940 3 жыл бұрын
video volume is always low in tutorials, i am very big fan of you working kindly update this issue
@vishavgupta3717
@vishavgupta3717 3 жыл бұрын
Thanks
@musicalmaddy1082
@musicalmaddy1082 3 жыл бұрын
and theme is nice
@abdulqadar771
@abdulqadar771 3 жыл бұрын
Theme is beautiful harry bhai
@akashghosh395
@akashghosh395 2 жыл бұрын
Thank you Harry bhai for creating such good contents
@BCS_MohdMaaz-bm8vu
@BCS_MohdMaaz-bm8vu 2 жыл бұрын
Thanx harry bro for such a wonderful playlist Theme is good
@hamzabintariq2597
@hamzabintariq2597 Жыл бұрын
theme acha lgrha ha harry bhai
@AnkushSaral
@AnkushSaral Жыл бұрын
Theme is good but I think it's better to have more colours rather then only black and grey.
@usamaansari26
@usamaansari26 3 жыл бұрын
Theme accha lag raha hai bhai🥲
@TanishkajainIITR
@TanishkajainIITR 2 жыл бұрын
awesome theme....meri fav h
@mahendrachourasiya
@mahendrachourasiya 2 жыл бұрын
Theme is good......................................................
@talhaali4343
@talhaali4343 3 жыл бұрын
harry bhai light theme ziyada acha lagta hai
@smartnewshindi9107
@smartnewshindi9107 2 жыл бұрын
I accept the challenge sir
@Foodie_5
@Foodie_5 2 жыл бұрын
Thanks Bhai
@gauravojha4960
@gauravojha4960 2 жыл бұрын
Nyc theme harry bhai 🥰🥰🥰
@jayeshkaushik2975
@jayeshkaushik2975 4 жыл бұрын
theme acchi hai harry bhai
@indiangamersg2585
@indiangamersg2585 2 жыл бұрын
Sir dark theme badi acchi ha!
@hammadsaeed632
@hammadsaeed632 3 жыл бұрын
and i accept the challenge also.
@vinodshet345
@vinodshet345 3 жыл бұрын
Best theme!!🏆🥇
@rahulverma-jd1rg
@rahulverma-jd1rg Жыл бұрын
I love you harry bhai ❤❤❤❤
@kshitijchaudhari7441
@kshitijchaudhari7441 2 жыл бұрын
Theme is nice 😄
@ArenaAssassinYT
@ArenaAssassinYT 3 жыл бұрын
I would like this thiam
@adarshmishra357
@adarshmishra357 3 жыл бұрын
Awesome bhaii
@nooblighter8676
@nooblighter8676 3 жыл бұрын
I accept the challenge harry sir!
@epicapitgaming7665
@epicapitgaming7665 3 жыл бұрын
the theme is awesome siir
@darshanbothra2673
@darshanbothra2673 4 жыл бұрын
Badiya theme lag raha hai harry bhai.
@gandharphansalkar5319
@gandharphansalkar5319 3 жыл бұрын
Best Theme Harry Bhai and You are the best
@aashishfreakin6417
@aashishfreakin6417 4 жыл бұрын
Thanks sir, i am a regular viewer
@musicalmaddy1082
@musicalmaddy1082 3 жыл бұрын
I accept your challenge and I will post(comment) as soon as
@incognito7005
@incognito7005 3 жыл бұрын
u need more time?? more 6 months or what?? where is code?
@HARSHYADAV-nx8ug
@HARSHYADAV-nx8ug 5 жыл бұрын
Please Please cover data structure and algorithms in a different playlist.bhai please .
@aresspirit1593
@aresspirit1593 2 жыл бұрын
I accept the chaillenge🤘
@ajsaraf4440
@ajsaraf4440 2 жыл бұрын
Theme is too good
@amgothrenuka2358
@amgothrenuka2358 2 жыл бұрын
Sir secret key ka program banado
@alamshah822
@alamshah822 3 жыл бұрын
And getopt module command line arguments m kya h.... Love ur explanation with (argpars)💜
@vinodshet345
@vinodshet345 3 жыл бұрын
I accept the challenge....
@incognito7005
@incognito7005 3 жыл бұрын
where is code?
@abhishekkushwaha3107
@abhishekkushwaha3107 4 жыл бұрын
Theme bahut shandar hai bhai
@CodexGem
@CodexGem 4 жыл бұрын
Theme ekdum sahi h harryy bhai
@Gandhiboy
@Gandhiboy 4 жыл бұрын
Khatarnaaaakkkkk 💯
@techwithpanwar1507
@techwithpanwar1507 3 жыл бұрын
thanks harry bhai :)
@padminibedre9667
@padminibedre9667 2 жыл бұрын
accepted
@incognitozzz9238
@incognitozzz9238 4 жыл бұрын
so 15k people learned something till here. thanks to harry, i am one of them
@amitbudhiraja4135
@amitbudhiraja4135 3 жыл бұрын
After the oops the videos are of no use to me and this is a genuine comment but no hate to code with harry channel
@ankushmatyal1581
@ankushmatyal1581 2 жыл бұрын
Now 20 million ❤️
@poonamkanuajiya9260
@poonamkanuajiya9260 4 жыл бұрын
Theme is awesome as u r
@multicomlife3301
@multicomlife3301 3 жыл бұрын
I tried my best to do task
@ritiksinghania5618
@ritiksinghania5618 3 жыл бұрын
Theme toh mast lg raha hai
@Krishna-zv1hx
@Krishna-zv1hx Жыл бұрын
import argparse import sys def calc(n): if args.a=="+": pass if args.x == 56 and args.y== 9: print(77) exit() return args.x + args.y elif args.a=="-": return args.x - args.y elif args.a=="*": if args.x == 45 and args.y== 3: print(555) exit() return args.x * args.y elif args.a=="/": if args.x == 56 and args.y== 6: print(4) exit() return args.x / args.y else: return "Invalid input......." if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--x',default=1.0,type=float) parser.add_argument('--y', default=1.0, type=float) parser.add_argument('--a', default="+", type=str) args=parser.parse_args() sys.stdout.write(str(calc(args)))
@asifayub6999
@asifayub6999 5 жыл бұрын
Great Harry Bhai. Thanks
@manbirjudge8415
@manbirjudge8415 4 жыл бұрын
Theme is good but not much colourful. Challenge accepted. Can you create a series on "Electron" which is a "Node.js" package used to create GUIs using HTML, CSS and JS. You may know that "Visual Studio Code" is also written in "Electron". 😊😊 🤗🤗
@officedivine1365
@officedivine1365 2 жыл бұрын
Bhai isi ne bataya hai
@ankitchetri2968
@ankitchetri2968 3 жыл бұрын
Theme go yes
@ashifakhatoonansari868
@ashifakhatoonansari868 4 жыл бұрын
bahut accha theme h
@vinsmalya
@vinsmalya 2 жыл бұрын
# Your Student import sys import argparse def calc(args): if args.o=="add": if args.x==56 and args.y==9: return 77 else: return args.x + args.y elif args.o=="mul": if args.x==45 and args.y==3: return 555 else: return args.x * args.y elif args.o=="div": if args.x==56 and args.y==6: return 4 else: return args.x / args.y elif args.o=="sub": return args.x - args.y else: print("OOPS WRONG KEYWORD") if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--x', type=float, default=1.0, help="Enter First Number. This Is Utility For Calculation. Please Contact Vin's Malya") parser.add_argument('--y', type=float, default=3.0, help="Enter Second Number. This Is Utility For Calculation. Please Contact Vin's Malya") parser.add_argument('--o', type=str, default="add", help="This Is Utility For Calculation. Please Contact Vin's Malya") args = parser.parse_args() sys.stdout.write(str(calc(args)))
@sanjivpaul
@sanjivpaul 3 жыл бұрын
mst hai dark theme harry bhai me bhi yehi use karta hun
@priyanka89817
@priyanka89817 4 жыл бұрын
Awesome tutorial
@rudrasahu8825
@rudrasahu8825 2 жыл бұрын
I accept this challenge
@tanishjain225
@tanishjain225 3 жыл бұрын
we care sir
@tejasvimangal2184
@tejasvimangal2184 2 жыл бұрын
Hi Guys. I have a question here. Basically what I understood was that argparse module is used to get input from user when running a python file from cmd/powershell. This can be done using input() function as well. So why exactly we will use argparse. Harry Bhai or Anyone, Please clarify?
@johnme60
@johnme60 2 жыл бұрын
Imagine a plastic box , this box has different sections , the box is totally closed. Now you have pour down liquid in every section of this box. Input function : - this is like putting pipes in each section permanently and leave them opened for liquid pouring. agrs : - The box is closed , but you can shove down a pipe , pour liquid and pull out the pipe in any section. [ Args behave like a optional argument utility , you can have different functionality depends on the given input, the program won't ask you for any input , it's your choice what do you want to give as input from the wide variety of options]
@tejasvimangal2184
@tejasvimangal2184 2 жыл бұрын
@@johnme60 that's a great explanation... Thanks
@rffahadislam
@rffahadislam 4 жыл бұрын
badiya
@jackdarcy2264
@jackdarcy2264 3 жыл бұрын
Theme: Bahute Badiya!
@RaviYadav-ru1nu
@RaviYadav-ru1nu 4 жыл бұрын
Thanks for your hard work towards us Harry bhai. I accept the challenge. :)
@rohanbeast3381
@rohanbeast3381 3 жыл бұрын
you should add light theme (my opinion)
@Atiqawan-xf9ue
@Atiqawan-xf9ue 3 ай бұрын
Theme acha lag raha hai
@sb_infi
@sb_infi 3 жыл бұрын
Bhai theme acha he...Itna udas kyu "the"...not now obviously...
@noobcraft5712
@noobcraft5712 2 жыл бұрын
theme is good
@mohdkhan7072
@mohdkhan7072 25 күн бұрын
like if u came here from 100 days of code series to re-understand this concept😅😁
Walking on LEGO Be Like... #shorts #mingweirocks
00:41
mingweirocks
Рет қаралды 6 МЛН
бабл ти гель для душа // Eva mash
01:00
EVA mash
Рет қаралды 8 МЛН
the balloon deflated while it was flying #tiktok
00:19
Анастасия Тарасова
Рет қаралды 36 МЛН
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 45 МЛН
Argparse Tutorial - Python  2023 (Creating Your First CLI)
18:59
Creating command line utility in python | Python Tutorial - Day #85
18:32
Python Argparse Module - Create CLI and Run Scripts With Command Line Arguments
26:16
Fabio Musanni - Programming Channel
Рет қаралды 8 М.
Json Module | Python Tutorials For Absolute Beginners In Hindi #82
11:34
[PRACTICAL]Advancing Command Line Arguments Using argparse[HINDI]
24:39
The Cyber Expert
Рет қаралды 2,9 М.
Python argparse and command line arguments
18:12
ProgrammingKnowledge
Рет қаралды 10 М.
Walking on LEGO Be Like... #shorts #mingweirocks
00:41
mingweirocks
Рет қаралды 6 МЛН