Getters and Setters in Python | Python Tutorial - Day #60

Поділитися
Вставка
  • Опубліковано 26 жов 2024

КОМЕНТАРІ • 362

  • @dawood3578
    @dawood3578 3 місяці тому +41

    Those who didn't understand, please don't comment and read this once:
    In Python, getters and setters are used to control the access and modification of class attributes. They are commonly used to enforce data encapsulation and validate the input before allowing changes to the attribute.
    Here is a simple example to demonstrate the concept of getters and setters in Python:
    class Person:
    def __init__(self, name, age):
    self._name = name
    self._age = age
    # Getter method for getting the name attribute
    def get_name(self):
    return self._name
    # Setter method for setting the name attribute
    def set_name(self, name):
    self._name = name
    # Getter method for getting the age attribute
    def get_age(self):
    return self._age
    # Setter method for setting the age attribute
    def set_age(self, age):
    if age > 0:
    self._age = age
    else:
    print("Age must be a positive number.")
    # Creating an instance of the Person class
    person = Person("Alice", 30)
    # Using the getter method to get the name attribute
    print(person.get_name()) # Output: Alice
    # Using the setter method to set the name attribute
    person.set_name("Bob")
    print(person.get_name()) # Output: Bob
    # Using the setter method to set the age attribute with an invalid value (negative number)
    person.set_age(-5) # Output: Age must be a positive number.
    # Using the setter method to set the age attribute with a valid value
    person.set_age(35)
    print(person.get_age()) # Output: 35
    In this example, the Person class has getter and setter methods for the name and age attributes. The getter methods allow us to retrieve the values of the attributes, while the setter methods allow us to modify the values with some validation logic.
    By using getters and setters, we can ensure that the class attributes are accessed and modified in a controlled way, which helps in maintaining the integrity of the data within the class.

    • @ibrahimparkar6900
      @ibrahimparkar6900 3 місяці тому

      thank man now I understand.

    • @dawood3578
      @dawood3578 3 місяці тому

      @@ibrahimparkar6900 no problem. Take help of Ai wherever you get stuck.

    • @rajdeepsingh8363
      @rajdeepsingh8363 3 місяці тому +1

      But bro we can also access the value without using getters then why we used getters.plz reply??

    • @ibrahimparkar6900
      @ibrahimparkar6900 3 місяці тому

      @@rajdeepsingh8363 read the last para

    • @shivaniputtoju3133
      @shivaniputtoju3133 2 місяці тому

      you made it simple thanks

  • @arpanadhikari6881
    @arpanadhikari6881 Рік тому +244

    My experience for Getters and Setters is 2/10. You made the topic a bit tough. you explained like this is a revision class for getter and setter. I am very my delighted with this 100 days coding challenge. I give it a solid 9/10 for the python playlist. But in this topic you were a bit inconsistent.

    • @harshitha.m.4189
      @harshitha.m.4189 Рік тому +27

      yes i agree he didn't make this topic well enough for beginners to understand

    • @anupkanu7659
      @anupkanu7659 Рік тому +11

      totally agree man.

    • @neverlost7195
      @neverlost7195 11 місяців тому +8

      yeah you are right. Kinda looked like he was in a hurry.

    • @musicaljoker1115
      @musicaljoker1115 11 місяців тому +21

      same with decorator

    • @uttambarve9425
      @uttambarve9425 11 місяців тому +3

      agreed

  • @nihanshupethe8983
    @nihanshupethe8983 Рік тому +75

    This topic was so easy but you made it little bit tough.
    If you don't use 10 it would be much easier.

  • @Coherentsoul
    @Coherentsoul Рік тому +82

    This is the first lesson that i didn't really understand. 😵

    • @mdadil1456
      @mdadil1456 7 місяців тому +3

      han mje mushskil horahi hai.

    • @NeelRajora_
      @NeelRajora_ 6 місяців тому +2

      In Object Oriented Programming, Getters and Setters help in rewriting Protected/Private Variables through the Class itself, because these Variables do not allow Rewrite unless you have access to the source code.

    • @tarsemlal1720
      @tarsemlal1720 4 місяці тому +1

      Same bros it is a little difficult

  • @SaiManognyaDesetty-bs3gp
    @SaiManognyaDesetty-bs3gp 11 місяців тому +38

    All the videos until now have been amazing!
    In this video I did not get a clear idea of the functioning of getters and setters, and why these are actually required. Can anyone please elaborate?

    • @animeforever8508
      @animeforever8508 8 місяців тому +1

      In object-oriented programming, Getter and Setter methods are used to access and modify the private variables of a class, respectively.

    • @GauravPathak-u8m
      @GauravPathak-u8m 7 місяців тому +7

      Setter is used to set value for a variable and getter for getting the value suppose you are writing a bank application and you want a method which will set the balance for a customer after few validation only like he will put some pin or password only then his amount should be set to entered value so in this case you can make use of setter method where you can write your validation logics before setting value of amount. Similaraly in case of getter suppose a customer need info of amount available in his account you can write some validation before giving him details to verify if it’s a correct customer. Hope this helps

    • @SaiManognyaDesetty-bs3gp
      @SaiManognyaDesetty-bs3gp 7 місяців тому

      Thank you! ​@@GauravPathak-u8m

  • @sudhansubalasahoo
    @sudhansubalasahoo Рік тому +42

    Present Sir
    You told us to tell the meaning of *args and **kwargs in dictionaries video but you haven't told us, so please explain

    • @indianheartbeat9005
      @indianheartbeat9005 8 місяців тому +2

      *args and**kwarge is a syntax to pass all available arguments directly. I there are no arguments it will pass nothing but if it has 10 argument it will pass 10 in same order.. it makes things dynamic for scenarios like previous video

    • @arnabkundu1648
      @arnabkundu1648 4 місяці тому +4

      It was taught in arguments of functions video(day 21)

  • @theroshantune
    @theroshantune Рік тому +9

    incredible!
    i can't believe that we have completed 2 months in this golden journey
    wanted to see me after 1 month and 9 days!

    • @ek__villain
      @ek__villain Рік тому +5

      I came here to watch this video within 2 weeks

  • @Random-Sad
    @Random-Sad 4 місяці тому +6

    For those who were not able to understand Getters and Setters with this video because it is really not taught in a good way as _value was written and it was never told that it is to make it protected and etc. So, you should consider watching one from these two videos or both of these to understand this topic:
    Couldn't add links in comments so search term for videos:
    1. Python OOP Tutorial 6: Property Decorators - Getters, Setters, and Deleters
    2. Setters & Property Decorators | Python Tutorials For Absolute Beginners In Hindi #69

  • @gamerofwolfstreet
    @gamerofwolfstreet Рік тому +7

    watching this for 2nd time getters & setters.. thoda confusing but iss baar understand karke jaunga

    • @valorantaccount462
      @valorantaccount462 Рік тому +5

      I believe in taking my time to fully comprehend and retain information, even if it requires multiple viewings. It is more important to understand thoroughly than to rush through and potentially forget. Slow and steady wins the race

    • @gamerofwolfstreet
      @gamerofwolfstreet Рік тому

      @@valorantaccount462 Thank you bro

  • @alshifabelim6190
    @alshifabelim6190 Рік тому +7

    A setter updates the value of a variable, while a getter reads the value of a variable.

  • @rohitjgamer5860
    @rohitjgamer5860 6 місяців тому

    Thank you Harry bai to making this topic so easy to understand, the way of explaining is fantastic, hopping to get projects on python soon.

  • @sahalAshfaq
    @sahalAshfaq 9 місяців тому +1

    I like this codeing course of python I see your html,css,python mr.haris ali khan

  • @hyperat936
    @hyperat936 4 місяці тому

    I will do that review after the completing the course for now it is going smoothly and awesome.

  • @Anita-cy4jv
    @Anita-cy4jv Рік тому +3

    Sir I am beginning I am starting our journey with python I have no laptop no computer only with mobile I am do best and upload so many python latest I will plese

  • @arpankarmakar16
    @arpankarmakar16 Рік тому +26

    It's an incredible journey harry bhai. It's 2 months since you started this course and you never took a day off! Hats off!
    EDIT: 100 Days of Code is completed, trust me this has the ability to change your life!

    • @sparkcodez
      @sparkcodez Рік тому +2

      bro i have seen you every time when i open comment section XD
      btw what class r you in?

    • @arpankarmakar16
      @arpankarmakar16 Рік тому +2

      @@sparkcodez Because I comment in every video, to prove that I'm consistent. And I'm in 9th class 😅

    • @sparkcodez
      @sparkcodez Рік тому

      @@arpankarmakar16 damn, i am in 7th(about to go in 8th) so ig Ur 14 years old?

    • @arpankarmakar16
      @arpankarmakar16 Рік тому

      @@sparkcodez Yup

    • @arpankarmakar16
      @arpankarmakar16 Рік тому

      @@sparkcodez When did you start learning to code?

  • @DOAKASHU
    @DOAKASHU День тому

    Must to do videos
    As a experienced developer i am still learning want to become best coder in world! I Will make the History

  • @a12gaming61
    @a12gaming61 5 місяців тому

    so guys, for those of you who didnt understand setters and getters .They are a same function which is made to behave as a setter as well as a getter ,when we use "property " attribute it behaves like a getter and when we use "setter" attribute is behaves like a setter

  • @palamu_tiger02
    @palamu_tiger02 Рік тому +6

    Thank you Harry Bhai. I watch your DSA full playlist. I get good understanding in DSA.

  • @CiscoSdwan-n9m
    @CiscoSdwan-n9m Рік тому +9

    I watched your 60 videos from my both accounts, it was revision of all your 60 videos out of 100, really informative, my logic got cleared and i started creating little test cases and unit tests based of python netmiko and paramiko as well. if you have videos about the api and web control using python and selenium, pls share link of that.

  • @susmitamainde6644
    @susmitamainde6644 3 місяці тому

    Thank you sir for playlist it's really awesome no doubt.. but this is the first video i didn't really understand.

  • @patkabhi
    @patkabhi Рік тому

    Great Harry Sir! I am very happy you are doing excellent job it will help every passionate Python programmer who seriously want to increase his knowledge and skills.
    Great work!! Hats off to your efforts

  • @Tech_Enthusiasts_Shubham
    @Tech_Enthusiasts_Shubham Рік тому +1

    thanks for makinğ this course it is really helpful for me and your teaching method is really fabulous sir

  • @adarsh-sharma
    @adarsh-sharma Рік тому +6

    As always, Amazing content Harry bhaiya.
    I wish this knowledge could be accessible in English for my abroad friends to understand.

    • @sudhansubalasahoo
      @sudhansubalasahoo Рік тому +2

      Well, you can always give them the repls as they are written in english

  • @HuzaifaKhan-iy5qj
    @HuzaifaKhan-iy5qj 3 місяці тому +1

    # Program to observe the getter and the setter properties
    class employe:
    def __init__(self, name, id):
    self._name = name
    self.id = id

    @property
    def name(self): #Getting the name
    return self._name

    @name.setter #setting the new name
    def name(self, newname):
    self._name = newname

    #Instance
    emp = employe("Fedrick", 23)
    print(emp.name, emp.id)
    emp.name = "Jimmy"
    print(emp.name)

  • @mayurn2985
    @mayurn2985 4 місяці тому

    The way he is teaching like is preparing for exams and revision classes please do make it little slow so that beginners could cope up with your speed

  • @narendraparmar1631
    @narendraparmar1631 9 місяців тому

    Very informative , Thanks Harry

  • @hasan_sagor111
    @hasan_sagor111 3 місяці тому

    Very helpful❤

  • @victorb22622
    @victorb22622 6 місяців тому

    Just before i came in comment section,,i can share my expression is , why i am learning python ,now its not entering in my mind .then I thought , I finished his 11 hours tutorial on python ,it was not as tough as this may be there may not be covered these things .but honestly i disspoint that why I am learning python!😅 ( Here I should also share , I m not searching job , just to add knowledge , so , I learn c, c# ,android ,js , html js CSS ,react , nodejs , machine learning, all from Harry's playlist) But at this point i feel ,why i m learning python that these is not entering in my mind😅

  • @Melody-Rishabh
    @Melody-Rishabh Рік тому +2

    yup bro u are really genius
    kafi jayada hadd tk knowledge h aapko is filed ki 👍

    • @Mohd_Zaid_khan
      @Mohd_Zaid_khan Рік тому +3

      Filed ki💀
      Apni knowledge to badha le bro

    • @Melody-Rishabh
      @Melody-Rishabh Рік тому +1

      meri filed different h bro business line h bro
      par me chahta computer line tha 😊.

  • @nipainsaini5414
    @nipainsaini5414 8 місяців тому

    awesome course. thanks indeed

  • @sawaijangid1435
    @sawaijangid1435 Рік тому +2

    It's incredible Harry bhai 🔥🔥🔥

  • @Syed-j4h
    @Syed-j4h Місяць тому

    People
    Objects have properties
    Getter changes a method into property
    Setter used to change the value of the object property
    It is very simple I also got frustrated a lot but listen me it's easy watch full video , if didn't understood watch last 2 to 3 videos
    It's easy

  • @sheikhiftekharhossainabir7186
    @sheikhiftekharhossainabir7186 5 місяців тому +2

    You present this tutorial very complexly. Upload a new tutorial for the alternative of this video

  • @moinuddinmoin392
    @moinuddinmoin392 Рік тому

    class MyClass:
    def __init__(self, value):
    self._value = value
    In self._value why we use underscore (_) at the beginning of value???

    • @shivang7679
      @shivang7679 Рік тому

      even im confused u got answer??

  • @deshantbrahman4462
    @deshantbrahman4462 Рік тому

    just amazing broooo thankyou for this kind of content

  • @harmansingh4232
    @harmansingh4232 Рік тому +1

    Hi Harry bro please make a series regarding algo trading in python ?

  • @sneharamani2556
    @sneharamani2556 6 місяців тому

    this is very good to learn

  • @ayushkaprasad107
    @ayushkaprasad107 4 місяці тому

    Private variable were not mentioned here which lead to so many confusion and took lot of time to understand the topic also disappointed becoz the topic wasnt well explained...wasnt easy to comprehend...

  • @meditationmusic6482
    @meditationmusic6482 Рік тому +1

    Thanks sir.

  • @PupunParida-b7m
    @PupunParida-b7m 7 місяців тому

    best understaning example sir, bas data science roadmap with course vdo leaoo

  • @sorrybroimpro4028
    @sorrybroimpro4028 11 місяців тому

    8/10 i want that you solve real life questions and give us for homework also apart from project
    otherwise overall its a great course

    • @RoyalPandit021
      @RoyalPandit021 9 місяців тому

      Theya re already present on his channel

  • @md.abdullahalmamun960
    @md.abdullahalmamun960 Рік тому

    i am watch your ragularly
    but some time mis your video
    but than i watch video regularly

  • @kanikaarora606
    @kanikaarora606 Рік тому

    you always helped me alot😊😊

  • @skyupgamer5818
    @skyupgamer5818 Рік тому

    thanks for this video

  • @farhanali4884
    @farhanali4884 Рік тому +1

    Thanks bro for this

  • @harshalikawade2041
    @harshalikawade2041 5 місяців тому

    Thank You

  • @vanshsharmaM4A1
    @vanshsharmaM4A1 Рік тому +1

    Harry bhai replit ki theme customize kar lo, mast lagega

  • @osamakamal9490
    @osamakamal9490 Рік тому +1

    Hi Sir , I am from Pakistan and I am new here.
    Your teaching method is amazing.
    Sir, kindly guide me about that how can I access your notes that you write.
    Thank you for uploading such an amazing tutorial.

    • @arshdeepsaluja9445
      @arshdeepsaluja9445 Рік тому

      if you want to access written notes then go python in one video (15hrs) in description you will find the notes

  • @suhasbandal6784
    @suhasbandal6784 Рік тому +1

    Bhai please make a video on excel, power bi, tableau, sql and data science

  • @PrabhatKumar-sb5fk
    @PrabhatKumar-sb5fk Рік тому

    thanks for your effort sirr.

  • @sakshijagtap2458
    @sakshijagtap2458 9 місяців тому

    😍😚course is going well

  • @srfahim23
    @srfahim23 Рік тому +1

    This is 60 days mind blowing

  • @pawanbadgujar3316
    @pawanbadgujar3316 Рік тому +3

    Sir plz create DBMS tutorial also....🥺🥺

  • @amit_sahni22
    @amit_sahni22 Рік тому +2

    Which is better React Js or NextJS for medium and large projects with Django Rest Framework?
    Please reply 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

    • @ezmayur
      @ezmayur Рік тому

      On top of NextJs is best overall

  • @shivang7679
    @shivang7679 Рік тому

    watched 1 times didnt understand and watched 2nd time little bit understand now going for other source video

  • @anonymous____________________4

    Pranam bhrata 🙏 apka bahutt baht dhanyawad 🙏❤️🙏

  • @siddhantdhandhania7679
    @siddhantdhandhania7679 6 місяців тому

    bro aapne getter bada ajeeb way meh bataya hai, bina getter ke direct object._value karke bhi we can get the value , so why use getter?

  • @zq.nain.
    @zq.nain. 8 місяців тому

    If you want to understand it completely then write the same code 3 times on you computer, Best of Luck :)

  • @techwala1038
    @techwala1038 Рік тому

    Hello harry sir I'm from Lucknow please make a video on all modules of python

  • @thelifestylestand9366
    @thelifestylestand9366 9 місяців тому

    What is the use of getters and setters Harry?

    • @NeelRajora_
      @NeelRajora_ 6 місяців тому

      Getters and Setters are used to access Protected or Private Variables in a Class. In case you want to edit your user data in a Class without access to the source code (which is Protected, of course), then Getters and Setters will be used to Rewrite the Data.

  • @aryanlokhande7421
    @aryanlokhande7421 Рік тому

    *Not Clear*
    Getters and Setters Not Explain Well
    Before 60days everything was Nicely Explain ❤️

    • @Mayukh04
      @Mayukh04 8 місяців тому

      Same with me.Decorators bhi clear nhi huye

  • @Dmdmsmsj
    @Dmdmsmsj Рік тому +4

    This chapter was too much hard i watched it 4 time and also done in replit 6 times

  • @shardulsharma6899
    @shardulsharma6899 Рік тому +1

    Am i the only one who thinks he teaches like we already know everything? because he already knows everything, so its easy for him but not for neutral audience who is just beginning with python.

    • @TravelTales-a
      @TravelTales-a Рік тому

      yes i also think that, few times he did that like in logging module i cant understand that and know in getter and setter he make sit a little rough

  • @farhanali4884
    @farhanali4884 Рік тому +1

    Sir your video is not showing on replit
    what's the reason

  • @abhishekvishwakarma9045
    @abhishekvishwakarma9045 Рік тому +9

    hi harry bhai, but here at 6:42 wanted to know whether this is encapsulation or abstraction (as abtraction is hiding the implmentation details of code and encapsulation is hiding the data visibility from the user by combining data with functions) so little confused here , thanks ;)

  • @Manish-qt1bz
    @Manish-qt1bz Рік тому +2

    Present Sir 🔥

  • @shubhamthakur8294
    @shubhamthakur8294 Рік тому

    do we always have to create getter first in order to create setter??

  • @GlitchyGlobe
    @GlitchyGlobe 10 місяців тому

    Yeh video difficult tha harry bhai

  • @Tristaxx
    @Tristaxx 8 місяців тому +1

    dhanyawad HarryHarryHarry

  • @clashingtv2527
    @clashingtv2527 Рік тому +1

    I love to use vscode😁 but Mera laptop itna power full nahi he ki wo replit ko run karsake

  • @bkxahmadplays6183
    @bkxahmadplays6183 7 місяців тому

    @code with harry
    Make this video again in easy way 😅😅

  • @aniketkushwah
    @aniketkushwah Рік тому +1

    Bhai blog ke liye best hosting provider kon hai GoDaddy & hostinger ya fir koi or plezz ripley

  • @vipulade6520
    @vipulade6520 3 місяці тому

    In this comment section, there are few people who are saying that they didn't understood this topic at all and other side some are totally oppposite, who understood this topic with no doubts! thats strange 😵🤨

  • @justmadyo
    @justmadyo Рік тому

    Tq sir✌️

  • @DishaanChahal
    @DishaanChahal 8 місяців тому

    Feb went by very quickly, 19th feb today

  • @ishawaris632
    @ishawaris632 Рік тому

    Great🙌

  • @SajanKumar-ec2us
    @SajanKumar-ec2us 10 місяців тому

    Make seprate video for your replet access

  • @Haribansh-zt5qz
    @Haribansh-zt5qz Рік тому

    Day60 completed harry bhai.

  • @T.Akshay_Pratap_Singh
    @T.Akshay_Pratap_Singh Рік тому

    SOURCE CODE:
    # Getters and Setters in Python
    # example of Getters
    """
    class MyClass:
    def __init__(self, value):
    self._value = value

    def show(self):
    print(f"value of object is {self._value}")
    @property
    def ten_value(self):
    return 10*self._value
    obj = MyClass(10)
    print(obj.ten_value)
    obj.show()
    """
    """
    Output:
    100
    value of object is 10
    """
    # another example of getters
    """
    class MyClass:
    def __init__(self, value):
    self._value = value

    @property
    def value(self):
    return self._value
    obj = MyClass(10)
    print(obj.value)
    """
    """
    Output:
    10
    """
    # Example of Setters
    """
    class MyClass:
    def __init__(self, value):
    self._value=value
    @property
    def value(self):
    return self._value
    @value.setter
    def value(self, new_value):
    self._value = new_value

    def show(self):
    print(f"value is {self._value}")
    obj = MyClass(10)
    obj.value = 20
    obj.show()
    print(obj.value)
    """
    """
    Output:
    value is 20
    20
    """
    # another example of Setters in Python
    """
    class MyClass:
    def __init__(self, value):
    self._value = value

    #getter
    @property
    def value(self):
    return self._value
    #setter
    @value.setter
    def value(self, new_value):
    self._value = new_value
    obj = MyClass(10)
    obj.value = 20
    print(obj.value)
    """
    """
    Output:
    20
    """

  • @iam_mrbean
    @iam_mrbean Рік тому +1

    Harry bhayya webrtc se video call app tutorial banana

  • @siddhugupta9406
    @siddhugupta9406 Рік тому

    harry bhai please react native ko javascript ke sath use karne ka bhi course bana doo please 🙏

  • @kamal_kumar19k
    @kamal_kumar19k Місяць тому

    Got it !!!!🎉🎉🎉🎉

  • @anishkumarmishra9620
    @anishkumarmishra9620 Рік тому

    Harry bhai, getter is behaving like normal methods then what is the use of it ?? Without using @property annotation in your program(i.e getter ) it will perform its action .

    • @rajdeeprautela5658
      @rajdeeprautela5658 Рік тому

      The use is encapsulation i.e. hiding variables of the class object so that they cannot be modified by anybody and if we need to modify, it can be done only by the specied methods. Using getters and setter made it possible to hide the original variable names (encalpsulation)

  • @AnilKumar-xl1ju
    @AnilKumar-xl1ju Рік тому

    print("I am Present")

  • @tourwithgaumji8171
    @tourwithgaumji8171 Рік тому +1

    Please upload a HR ABAP & debugging video,🙏🙏🙏🙏🙏🙏

  • @proudtobeindian1894
    @proudtobeindian1894 Рік тому +1

    Get ,set ,python
    (Property and Go dono hi acche nai lag rahe the)
    #day60
    #100daysofcode
    #cwh

  • @HashirKhan-oy1pi
    @HashirKhan-oy1pi Рік тому +1

    How to use deepface lab on andriod

  • @itexpert6463
    @itexpert6463 Рік тому

    Method overriding and method overloading konse video mai bataya hai

  • @youtubewatcher2594
    @youtubewatcher2594 Рік тому +1

    It is the first thing in this course which i found very difficult to understand. 😥

  • @EmpowerTheVoice
    @EmpowerTheVoice 9 місяців тому

    class Person:
    def __init__(self, name, age):
    self._name = name # Private attribute with a single leading underscore
    self._age = age
    # Getter method for the name attribute
    def get_name(self):
    return self._name
    # Setter method for the name attribute
    def set_name(self, new_name):
    self._name = new_name
    # Getter method for the age attribute
    def get_age(self):
    return self._age
    # Setter method for the age attribute
    def set_age(self, new_age):
    if new_age >= 0:
    self._age = new_age
    else:
    print("Age cannot be negative.")
    # Creating an instance of the Person class
    person1 = Person("John", 25)
    # Using the getter methods
    print("Name:", person1.get_name())
    print("Age:", person1.get_age())
    # Using the setter methods
    person1.set_name("Jane")
    person1.set_age(30)
    # Displaying updated values using the getter methods
    print("Updated Name:", person1.get_name())
    print("Updated Age:", person1.get_age())

  • @sagarjuneja2443
    @sagarjuneja2443 Рік тому

    are sir ji is series mai django bhi include kr de na

  • @m.hassaanvi-f7835
    @m.hassaanvi-f7835 Рік тому

    Exercise 5:
    import random
    import time
    score_comp = 0
    score_human = 0
    rules = "between snake and gun : the gun is going to win | between water and gun : the water is going to win | "
    comp = random.randint(0,2)
    if (comp == 0):
    comp = "snake"
    elif (comp == 1):
    comp = "water"
    else:
    comp = "gun"
    human = input("Enter '0' for Snake, '1' for Water and '2' for Gun and '3' for rules: ")
    if (human == '0'):
    human = "snake"
    print(f"Your choice is : {human}")
    elif (human == '1'):
    human = "water"
    print(f"Your choice is : {human}")
    elif (human == '2'):
    human = "gun"
    print(f"Your choice is : {human}")
    elif (human == '3'):
    print(f"the rules are stated below:
    {rules}")
    else:
    print("Error!:Read carefully and enter '0' for Snake, '1' for Water and '2' for Gun")
    if (human == "snake" and comp == "gun"):
    score_comp += 1
    elif (human == "gun" and comp == "snake"):
    score_human +=1
    elif (human == "gun" and comp == "water"):
    score_comp += 1
    elif (human == "water" and comp == "gun"):
    score_human += 1
    elif (human == "water" and comp == "snake"):
    score_comp += 1
    elif (human == "snake" and comp == "water"):
    score_human += 1
    else:
    print(f"Tie! both of the opponents have choosed the {human} ")
    if (human != '3'):
    print(f"Computer's choice is : {comp}")
    print(f"Computer's Score is {score_comp}")
    print(f"Your Score is {score_human}")
    time.sleep(50)

    • @bepositive271
      @bepositive271 Рік тому

      you repeat the code too much time don't do hard coding do smart coding

  • @chandankushwaha8932
    @chandankushwaha8932 Рік тому

    awesome

  • @Radhe_radhe2929
    @Radhe_radhe2929 Рік тому +1

    Happy republic day 🇮🇳💗🔥😎

  • @shivamchaudhary8592
    @shivamchaudhary8592 Рік тому +1

    #Day60 Present Sir

  • @aakashjha3150
    @aakashjha3150 7 місяців тому +1

    Harry Bhai your value, __value, value(), ten_value, new_value examples confuse us a lot !!
    please take a good example 🙏🙏🙏🙏

  • @rahulsingbhate
    @rahulsingbhate Рік тому

    Harry Sir please tell me Physics Walla ne full stack developer ka course Lunch Kiya hai please review karo aur batao ki ye course enough hai kya ya apki YT playlist par jo free hai o hi enough hai please batao

  • @girirajsanghani5565
    @girirajsanghani5565 Рік тому

    grate👍👍👍👍👍👍👍👍👍👍👍👍

  • @slayfantastic8070
    @slayfantastic8070 Рік тому

    Keep growing brother

  • @SamratBioCelebsWiki
    @SamratBioCelebsWiki Рік тому +1

    why you wrote _value?