CS50P - Lecture 1 - Conditionals

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ก.พ. 2025

ความคิดเห็น • 202

  • @lawniczakjohn
    @lawniczakjohn 2 ปีที่แล้ว +381

    This is what TH-cam is made for!

  • @paul-d-mann
    @paul-d-mann ปีที่แล้ว +103

    TH-cam isn’t social media… it’s a vital resource!!!

    • @2Dtrend
      @2Dtrend 7 หลายเดือนก่อน +3

      Here, here!

    • @aeducationenjoyer.1259
      @aeducationenjoyer.1259 5 หลายเดือนก่อน +1

      PREACH!

    • @choasisgoated
      @choasisgoated หลายเดือนก่อน +1

      True that brother

    • @paul-d-mann
      @paul-d-mann หลายเดือนก่อน

      @ YT has its problems, serious ones, but it’s still the last subscription I’d let go.

  • @cleidysbrooks
    @cleidysbrooks 2 ปีที่แล้ว +162

    Incredible how David teaches with excellent knowledge. It does it in such a way that you understand what you are doing. Thank you for teaching in such an excellent and emotional way David. You're the best.

    • @Sureshpaudel1
      @Sureshpaudel1 10 หลายเดือนก่อน +2

      I am 14 years and can understand it preety well accept the problem set need to see it 10 times to understand (can't they write it down in simple english )

  • @umair5807
    @umair5807 2 ปีที่แล้ว +93

    Thank u David. Your teaching style makes programming very easy.

    • @mjsmcd
      @mjsmcd 2 ปีที่แล้ว +4

      As a newbie I find it hard to remember all this

    • @nicksonmuthenya6997
      @nicksonmuthenya6997 ปีที่แล้ว +10

      @@mjsmcd Just do daily practice. The more you code (practice) these concepts the more you know them. Practice Practice Practice

    • @kaiofkai
      @kaiofkai 8 หลายเดือนก่อน

      @@mjsmcd there's no need to remember just understand the logic

  • @timothyfidelis5118
    @timothyfidelis5118 2 ปีที่แล้ว +20

    I' m in awe with the way David teach! Respect

  • @Girish-Navani
    @Girish-Navani ปีที่แล้ว +2

    the best python teacher i came across my python learning journey... sir you are legend tutor

  • @mariyayurchenko2790
    @mariyayurchenko2790 4 หลายเดือนก่อน +3

    Officially my favorite show now! Enjoying every episode. Awesome production, genius cast.

  • @jsonkody
    @jsonkody ปีที่แล้ว +33

    23:25 .. you can use "Alt + up/down" to shift the whole line up or down ;)
    very convenient, very fast
    Of course you may just hold Alt and keep pressing down down down down ... etc. then get another line and shift it up (it also work for multiple lines if you highlight them)

    • @Sureshpaudel1
      @Sureshpaudel1 10 หลายเดือนก่อน +1

      Bruh he knows it probably as he has a lot of experience but he is using it as it might be complex for us to understand and he will have to introduce next topic making it more complicated

    • @shafatpir1097
      @shafatpir1097 8 หลายเดือนก่อน +1

      thnaks

    • @ssgroast9640
      @ssgroast9640 7 หลายเดือนก่อน +2

      @@Sureshpaudel1 he probably left the comment for the viewers

    • @ryokkuz
      @ryokkuz 6 หลายเดือนก่อน

      thank you

  • @OmariEtetembaWilondja
    @OmariEtetembaWilondja 2 ปีที่แล้ว +6

    Best Teacher is the world, hands down!!!!

  • @amandeepsaha
    @amandeepsaha 2 ปีที่แล้ว +91

    CS50 is emotion

  • @janmohammad2542
    @janmohammad2542 ปีที่แล้ว +72

    I would only say:
    Name = input("who is the best python teacher? ")
    If name== "David j. Mallam":
    Print("correct answer")
    Else:
    Print("incorrect answer")

    • @oswi__
      @oswi__ 11 หลายเดือนก่อน

      Ахаахахах)

    • @iraiseddonut
      @iraiseddonut 7 หลายเดือนก่อน +5

      thats malan, your code is wrong either way

    • @cracked21
      @cracked21 3 หลายเดือนก่อน

      @@iraiseddonut congrats bro you won

    • @cracked21
      @cracked21 3 หลายเดือนก่อน

      name = input("who is the best python teacher?
      ")
      match name:
      case: "David J. Mallan"
      print("correct answer")
      case_:
      print("incorrect answer")

  • @Mathadder
    @Mathadder ปีที่แล้ว +6

    34:01 I don't know if "less than" is more efficient than "less than or equal to" since it's only checking one thing instead of two, but if it is, you could check in reverse and remove the "equal to" like so.
    if score < 60:
    print("Grade: F")
    elif score < 70:
    print("Grade: D")
    elif score

  • @lakshmiprabhakarkoppolu9100
    @lakshmiprabhakarkoppolu9100 ปีที่แล้ว +1

    48:00
    In Python 3, there is no maximum value for an int. It can store arbitrarily large numbers, limited only by the available memory on your system. This is a change from Python 2, where int had a maximum value of 2**31 - 1 (approximately 2 billion) on a 32-bit platform and 2**63 - 1 (approximately 9 quadrillion) on a 64-bit platform.

  • @AmSh-g9f
    @AmSh-g9f 2 หลายเดือนก่อน

    Yo, this course was seriously lit! 🔥 Learned so much, highly recommend! 💯📚

  • @indo244
    @indo244 2 หลายเดือนก่อน

    The quality of the content is impressive!

  • @mohammedsafiahmed1639
    @mohammedsafiahmed1639 2 ปีที่แล้ว +19

    43:20 I assume she meant once we define a fucntion, can we use it as a method, so can you use your own function , lets say func(), on some object, like object.func(). I dont think so. You'll have to define a class for that

    • @knowledgeseeker2452
      @knowledgeseeker2452 2 ปีที่แล้ว

      Hi.
      41:21 He defined two functions i.e. main() and is_even() but called main() function only. Why doesn't he call the second function? Isn't that necessary?

    • @coding3438
      @coding3438 2 ปีที่แล้ว +9

      @@knowledgeseeker2452 hello there!
      He only called the main function because that’s what he wanted to execute. If you see in the definition on main function, the third line called the is even function. ( if is_even(x):
      So by calling the main function, he is indirectly calling the is even function as well

  • @kylofps
    @kylofps 2 ปีที่แล้ว +8

    33:40
    Just an idea, but what if we split it up into 2 groups to reduce the amount of "questions" that we are asking?
    Something like this:
    if score >= 80:
    if score >= 90:
    print("Grade: A")
    else:
    print("Grade: B")
    else:
    if score >= 70:
    print("Grade: C")
    elif score >= 60:
    print("Grade: D")
    else:
    print("Grade: F")
    Not sure if this makes the program any more efficient, but it seems like it could reduce the average amount of questions we ask the program because, for example, if the score was an F, normally we check: is it an A? B? C? D? Oh it's an F. But for this we would check: is it a B or better? C or better? D or better? Oh it's an F.
    Of course that would mean it adds another question we are asking the program if the score is an A, because we have to check if it's a B or better first, but yeah.
    Let me know if this makes any sense 😄

    • @sohamdas7199
      @sohamdas7199 2 ปีที่แล้ว +1

      That's ok but the length of program still remains same,so doesn't make it any better

    • @chrisfielding143
      @chrisfielding143 2 ปีที่แล้ว +1

      I think the original most efficient version was
      if score>=90:
      elif score>=80
      elif score>=70
      elif score>=60
      else
      4 max questions, and you have 4 questions too in ur code, how did ur version reduce the number of questions asked. I didn't get it

    • @chrisfielding143
      @chrisfielding143 2 ปีที่แล้ว

      for 90+ ur code asks 2 questions, the original asks 1; for 80-90 score the original asks 2 questions, your code asks 2 and so on... if anything i think ur version is asking more questions in some cases

    • @chrisfielding143
      @chrisfielding143 2 ปีที่แล้ว +3

      but nice thinking never the less, the idea is to understand the inner workings of the code and strive towards more efficient coding.

  • @Sureshpaudel1
    @Sureshpaudel1 10 หลายเดือนก่อน +5

    I am 14 years and can understand it preety well accept the problem set need to see it 10 times to understand (can't they write it down in simple english )

  • @ishatariq9422
    @ishatariq9422 ปีที่แล้ว

    it is amazng how i did not even noticedd that it was going on and such a smooth lecture: i have never come across.

  • @tuanminhang4691
    @tuanminhang4691 2 หลายเดือนก่อน

    thank u david for giving me such wonderful Python lessons ❤❤

  • @aidsadsl999
    @aidsadsl999 3 หลายเดือนก่อน

    Awesome course once again! I would love to see the course with data science in python in the future!

  • @Monte7579
    @Monte7579 2 ปีที่แล้ว +1

    Thank You David Sir, Greetings from India

  • @kylofps
    @kylofps 2 ปีที่แล้ว +30

    About the pythonic expressions, I just figured out something could be simplified to
    print("Even" if int(input("What's x? ")) % 2 == 0 else "Odd")
    yeah, I realize it might not be as readable but I just thought it was cool lol

  • @ken305
    @ken305 7 หลายเดือนก่อน

    TH-cam is not s social media 😊❤
    it's emotion bcoz of David

  • @TaranBhagat
    @TaranBhagat 6 หลายเดือนก่อน

    He is a great teacher 🙏🌹

  • @freezyAndHaze
    @freezyAndHaze 2 หลายเดือนก่อน

    Thanks for this series! Turbo epic stuff!

  • @risirisinath
    @risirisinath ปีที่แล้ว +7

    lecture done #4/4/23. 10 more to go!

  • @noway-uz1cb
    @noway-uz1cb 2 หลายเดือนก่อน

    Day 1: 25:19
    Day 2: 56:07

  • @powerstanik
    @powerstanik ปีที่แล้ว +2

    i love the way he teach its amazing

  • @farhanishraq5812
    @farhanishraq5812 2 ปีที่แล้ว +22

    can you please make a couse on java and c++?that would be so helpful

    • @axelvirtus2514
      @axelvirtus2514 7 หลายเดือนก่อน +1

      Intro to programming,he write code in C I think

  • @hamzhskeef8579
    @hamzhskeef8579 หลายเดือนก่อน

    thank you very much proff , your explaining is much good

  • @bebitoomar
    @bebitoomar 2 ปีที่แล้ว +2

    That pause at 42:29 made everything sink in so bad

  • @storaman12
    @storaman12 2 ปีที่แล้ว +1

    The best of the best= David Malan

  • @sayori3939
    @sayori3939 2 ปีที่แล้ว +3

    30:10 I've never seen that '0' already excited for this course

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว

      Omg that match is like that "copy the homework but don't make it identical" meme, why isn't there a "default" but a "case _:" eww

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว

      I wonder why he didn't show the "if b in [a, b, c] syntax, maybe he's gonna show it in the array video

  • @leoprone1
    @leoprone1 6 วันที่ผ่านมา

    Great class! thanks!

  • @knowledgeseeker2452
    @knowledgeseeker2452 2 ปีที่แล้ว +5

    41:21 He defined two functions i.e. main() and is_even() but called main() function only. Why doesn't he call the second function? Isn't that necessary?

    • @muskanbani6111
      @muskanbani6111 2 ปีที่แล้ว +11

      because the is_even function is inside the main function, and calling main already calls the is_even fucntion(IG so)

  • @requiemholder1746
    @requiemholder1746 2 หลายเดือนก่อน

    print("What is the answer to the Great Question of Life, the Universe and Everything?")
    user_input = input("").strip().lower()
    match user_input:
    case "42" | "forty two" | "forty-two" :
    print("Yes")
    case _:
    print("No")
    print(user_input
    )

  • @mtahirbangash5422
    @mtahirbangash5422 2 ปีที่แล้ว +1

    too good method of teaching

  • @Ali-2812
    @Ali-2812 2 ปีที่แล้ว +2

    Great Stuff. Thank you

  • @satyamexclamatory
    @satyamexclamatory 6 หลายเดือนก่อน +3

    completed!
    5:15 PM
    25 July 2024

  • @MrBen698
    @MrBen698 2 ปีที่แล้ว +1

    What an interesting guy! thank you man!

  • @jadencresser
    @jadencresser 2 ปีที่แล้ว +4

    One year later finally finished lecture 1

    • @saadalbaaqir1888
      @saadalbaaqir1888 ปีที่แล้ว +9

      Im in awe to your level of procastination

  • @prathamsolanki742
    @prathamsolanki742 2 ปีที่แล้ว +3

    At 39:14 he said if this function returns true then program will print even. So is he saying that returning true will satisfy the formula or something else. Please help me

    • @mohammedfouzan9115
      @mohammedfouzan9115 2 ปีที่แล้ว +2

      if is_even: basically means if the function "is_even" is true (if the number is even, then it is true)

    • @prathamsolanki742
      @prathamsolanki742 2 ปีที่แล้ว +1

      @@mohammedfouzan9115 Thanks man ❤️

  • @marcelomonteirocarvalho5137
    @marcelomonteirocarvalho5137 ปีที่แล้ว

    Dear David, I love your classes, the way you teach is 5 stars. I have a question. Could we use match instead of elif in the exercise grade? Ps. I wanted to study at Harvard because of your classes. :)

  • @Colbrow
    @Colbrow 2 ปีที่แล้ว +2

    At 41:59
    Question with the function. Why on line 3 does he put an x in the () but on line 9 he puts a n in the ()? I don't really get the whole argument thing with a function.

    • @blackgrizzly4987
      @blackgrizzly4987 2 ปีที่แล้ว +2

      The x in line 3 is referring to the input of "def main()" and the n in line 9 refers to "any" number in the context of the new definition "def is_even()".
      IF you would use an x in both definitions, the programme would still run correctly because both x are nested inside different def-functions. But for the sake of clarity, David used an "n" which is often use to refer to ANY number.
      Thus, IF the n of "def is_even(n)" returns TRUE to "if is_even(x)" inside of "def main()" --> then "Even" is going to be printed.

    • @emmasong7366
      @emmasong7366 2 ปีที่แล้ว

      @@blackgrizzly4987 question please:
      I wrote the exact code but I couldn't call main()
      TypeError: main() missing 1 required positional arguments: 'x'
      Is what I get everytime, and even if I add x in main()
      NameError: name 'x' is not defined
      Is what I get .. .
      Do you please have any idea how to fix this error?

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว

      Did you watch lecture 0? He mentioned exactly that...

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว

      @@emmasong7366 you probably put a x inside the parentheses in "def main ()"

    • @RoccoCampana
      @RoccoCampana 2 ปีที่แล้ว

      @@blackgrizzly4987 Thank you! I scrolled for a while looking for someone who asked this question / answer. You rock!

  • @Ndujlz
    @Ndujlz 9 หลายเดือนก่อน

    day 4 27:13 coming back later today to finish the video 36:02

  • @rick9773
    @rick9773 2 ปีที่แล้ว +4

    I am a totally beginner at coding. I really want to know what kind of courses I can take to get a job as a programmer without a CS diploma? Or is it possible to get a job like this without a degree?

    • @Bennyrule
      @Bennyrule 2 ปีที่แล้ว +1

      many many people get computer programming jobs with only 6 months experience, while also being self taught

    • @rick9773
      @rick9773 2 ปีที่แล้ว

      @@Bennyrule Is there any website for programmers to share experiences so that a beginner can learn how to start?

    • @thenoobcoder6598
      @thenoobcoder6598 2 ปีที่แล้ว

      @@rick9773 th-cam.com/video/79pKwdiqcwI/w-d-xo.html
      I think this video will clear your doubt(if you still have that is)

    • @x6c3
      @x6c3 2 ปีที่แล้ว +3

      you can get a cs job without a cs degree but getting your first job might be hard, if you have enough experience and projects in your resume you're good to go.

  • @SnLeo-zx6qy
    @SnLeo-zx6qy 6 หลายเดือนก่อน

    if a != b: print("a is not equal to b")
    else: print("a is equal to b")
    This works just fine. Maybe this was what the guy wanted to know, if something like this will work (without indentation).

    • @ShaikAsma-q8p
      @ShaikAsma-q8p 3 หลายเดือนก่อน

      Without intendation we can't do

  • @JoaoPedro-ki7ct
    @JoaoPedro-ki7ct ปีที่แล้ว

    54:15 I don't recall pipes ( *|* ) being ever mentioned on this course,
    *Why* exactly were they used instead of simply adding an *OR* operator between each of the gryffindor names?

    • @searcherror4463
      @searcherror4463 10 หลายเดือนก่อน +1

      I think he was just adding it in to show that there are multiple ways to get the same answer. It just comes down to personal preference and how you want your code to look.

    • @JoaoPedro-ki7ct
      @JoaoPedro-ki7ct 10 หลายเดือนก่อน

      @@searcherror4463 it would have been nice if he had first explained what they are and why he used them instead, while I know what they meant even back then, others could not understand them

  • @theonewhoisfluff745
    @theonewhoisfluff745 ปีที่แล้ว +1

    At 39:51, the code works exactly the same way even if you omit the "else: return false" part. Why is that? Can someone explain to me?

    • @acidserpent5653
      @acidserpent5653 ปีที่แล้ว

      I think it is because even if you don’t add that bit, in the main part, it will still print odd if is_even does not come out to be true

  • @bigbro1815
    @bigbro1815 10 หลายเดือนก่อน

    thanks David

  • @hasibkazi1379
    @hasibkazi1379 ปีที่แล้ว

    53:00 How can we add lower () method to these strings? I want the right result if the user types mixing upper and lower case.

  • @caseyspaulding
    @caseyspaulding 2 ปีที่แล้ว +1

    Thank you

  • @zhouyu9971
    @zhouyu9971 2 ปีที่แล้ว +1

    12:48 Can i see this as entry level algorithm?

  • @shangobashi
    @shangobashi 2 ปีที่แล้ว +1

    Gosh, I finally understand the logic behind Return. Smh....

  • @GarouSigma
    @GarouSigma ปีที่แล้ว +1

    In the first code, are the first 2 lines just text or actually a variable? pls clarify

    • @coldfire6869
      @coldfire6869 ปีที่แล้ว +1

      It prompts the user to put in a value for x and y. The values are not hard coded

  • @zhouyu9971
    @zhouyu9971 2 ปีที่แล้ว +1

    Is this an even better understanding? by just converting integer to boolean, as most other program understand 0 value as False and 1 as True. So,Can I just >>> def is_odd(rt): >>> return bool(int(rt % 2)) ???

    • @chrisfielding143
      @chrisfielding143 2 ปีที่แล้ว

      yeah you can, good idea

    • @chrisfielding143
      @chrisfielding143 2 ปีที่แล้ว +1

      but then again you are making it a bit complex, feel like return rt%2==0 is short and sweer

  • @magrathea8797
    @magrathea8797 2 ปีที่แล้ว +3

    How I can get four dots using tab like david ?

    • @huginn3007
      @huginn3007 2 ปีที่แล้ว +1

      Just click on "Tab"

    • @magrathea8797
      @magrathea8797 2 ปีที่แล้ว

      @@huginn3007 I know this.
      But, I want that four dots also.

  • @MrIrresplaceable
    @MrIrresplaceable ปีที่แล้ว +1

    I want to create a Turkish subtitle for this video. How can I do so ?

  • @WA-ow1fr
    @WA-ow1fr 6 หลายเดือนก่อน

    Keep it up

  • @DanTheMan-mi7ic
    @DanTheMan-mi7ic ปีที่แล้ว +1

    Hi was wondering if anyone knows if match case. Does not work on all python services yet like Codecademy and pycharm ? As there is no automatic indentation or even when I put it in i receive a syntax error

  • @williamekborg5505
    @williamekborg5505 2 หลายเดือนก่อน

    Could anybody tell me why or in what scenario i would rather use the match/case method instead of the if method? From what i understand from the video it's more readable when you have a definitvie set of values but is there anyother usage where the match method is better suited than the if one? / sory for bad english, it's not my mothertounge.

  • @nny241
    @nny241 4 หลายเดือนก่อน

    for personal use 40:54

  • @sayori3939
    @sayori3939 2 ปีที่แล้ว +1

    I think i laughed way more at that "who?" Than i should.....

  • @shawkir35
    @shawkir35 ปีที่แล้ว

    amazing

  • @webdeveloper6593
    @webdeveloper6593 2 ปีที่แล้ว +1

    the "match" type is not working for me. instead it is throwing syntax error, i tried and tried and copied it that way. but is not working, anybody with any idea?

    • @davidjmalan
      @davidjmalan 2 ปีที่แล้ว +3

      Be sure to use Python 3.10!

  • @jyunbiiinn
    @jyunbiiinn ปีที่แล้ว

    52:07 does match cange to be switch?

  • @SuaXenStone
    @SuaXenStone ปีที่แล้ว

    Hi David, iam a totally beginner ,I don't understand where to start programming. Will you help me?

  • @Punam09674
    @Punam09674 5 หลายเดือนก่อน

    It's the best thing

  • @erikferre8481
    @erikferre8481 2 ปีที่แล้ว

    Hi i have a syntax problem idk why, im trying to do the "Grade" exercise at 27:00, when i try to do "if score >= 90 and

    • @erikferre8481
      @erikferre8481 2 ปีที่แล้ว +2

      already see the error, i forgot write score after "and"

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว +2

      You don't know how many times I've made that mistake when i first started

  • @TheEvilClipper
    @TheEvilClipper 2 ปีที่แล้ว +4

    I want to know how he got his VS code to look like that. I cant start new files from terminal i just get an error that i dont understand

    • @saifullahacda1109
      @saifullahacda1109 2 ปีที่แล้ว +1

      This only happens in Linux not in windows

    • @TheEvilClipper
      @TheEvilClipper 2 ปีที่แล้ว +2

      @@saifullahacda1109 kinda. he’s using a custom codespace that runs Linux I got some help in the discord and got it to work

    • @belabansal3356
      @belabansal3356 ปีที่แล้ว

      @@saifullahacda1109no if you type code correct.py it works

  • @mohammeddanish1181
    @mohammeddanish1181 9 หลายเดือนก่อน

    in 42:20 how the python knows that if it is true it should print even and if it is false it should print odd
    coz i modified the program by replacing false in the place of true and true in the place of false
    can anyone clear this doubt plss the program: def iseven(n):
    if n%2==0:
    return False
    else:
    return True

    • @saladijani3876
      @saladijani3876 4 หลายเดือนก่อน +1

      That's based upon ur users condition 😅

  • @architarya8272
    @architarya8272 ปีที่แล้ว

    lecture 2 done

  • @mahipalmahato7648
    @mahipalmahato7648 2 ปีที่แล้ว

    0:34:53

  • @jazzjohnson6
    @jazzjohnson6 9 หลายเดือนก่อน +1

    anyone watching this lets get in touch and learn together

    • @studytab2472
      @studytab2472 7 หลายเดือนก่อน

      Hi how far ahead are u?

    • @TaranBhagat
      @TaranBhagat 6 หลายเดือนก่อน

      I'm watching

  • @teaseskrishna9284
    @teaseskrishna9284 10 หลายเดือนก่อน

    most of doubt person from INDIA

  • @السيدمحمد-ط1ظ7ذ
    @السيدمحمد-ط1ظ7ذ 7 หลายเดือนก่อน

    عاااااااش

  • @olinabin2004
    @olinabin2004 ปีที่แล้ว

    25:59

  • @kamgamaiva1270
    @kamgamaiva1270 2 ปีที่แล้ว +1

    how do you know where to use the indentation?

    • @TheEternalSweetooth
      @TheEternalSweetooth 2 ปีที่แล้ว

      I believe when you ask a question and need to print a statement in answer to the question, the print function would be indented

    • @muhammadsaad2957
      @muhammadsaad2957 2 ปีที่แล้ว

      indentations tells the compiler that after a statement whatever is indented is part of that statement, for example if you noticed whatever david writes after defining main at start is actually indented but when he is defining a new functions he removes the indentation for def statement.

    • @mohammedsafiahmed1639
      @mohammedsafiahmed1639 2 ปีที่แล้ว

      you will get that will practice, when to indent and when not to. Simply put, you indent whenever some lines of code are a part of a condition, a loop, a function, or a class.
      Whatever you write indented under a function definition ( def function():), that code will be a part of that function, and will execute whenever that function is called. Likewise, whatever code is indented under a conditional will only be executed if the condition is true, same goes for a loop.
      Indention is a way to tell the compiler what part of the entire code is part if function / loop / if, and what isnt.

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว +1

      Normally you have indent when a statement ends with a colon like IF or defining a function or class, about how indentation works:
      # both this comment and the next
      # statement are on indentation "lv 0"
      Def something():
      # this is on indentation lv 1
      # everything that belongs to this
      # function will START at lv 1
      # now we have a if inside the func
      If a == b:
      # now this is indentation lv 2
      # since it's inside a if inside a
      # function
      If c == d:
      # this is indent lv 3
      #this is lv 2
      #this is lv 1
      #this is lv 0
      You have to determine what belongs to what, lv 1 belongs to the "something" func (including the if) lv 2 belongs to the if inside the function, lv 3 belongs to the if inside the if and lv 0 belongs the the "program" , hopefully yt doesn't wrap the lines and ruin everything ._.

    • @kamgamaiva1270
      @kamgamaiva1270 2 ปีที่แล้ว

      @@sayori3939 thank you

  • @janardhan2jordan
    @janardhan2jordan 2 ปีที่แล้ว +1

    ❤️❤️

  • @Ashley-rf1xq
    @Ashley-rf1xq 2 ปีที่แล้ว +4

    I want to be the one of puppet sitting there xD

    • @sayori3939
      @sayori3939 2 ปีที่แล้ว +1

      Yeah i wanna disguise as one :3

  • @thenoobcoder6598
    @thenoobcoder6598 2 ปีที่แล้ว +1

    match name :
    ^
    SyntaxError: invalid syntax
    Do anyone have solution?

    • @lockborethdevid3533
      @lockborethdevid3533 2 ปีที่แล้ว +2

      Try to run code on python version 3.10 above so that this new match feature work. Otherwise if your python version less than 3.10 it will not work.

    • @thenoobcoder6598
      @thenoobcoder6598 2 ปีที่แล้ว +1

      @@lockborethdevid3533 oh thanks for letting me know. I was using 3.9

    • @Konstantin9292
      @Konstantin9292 9 หลายเดือนก่อน

      @@lockborethdevid3533 I am on 3.11.9 and it does not work =( it looks like python do not recognize %

    • @Konstantin9292
      @Konstantin9292 9 หลายเดือนก่อน

      @@lockborethdevid3533 nevermind, I found the problem xD I F UP in the terminal! Shoul have cleaned it before running the program

  • @SgtPantz
    @SgtPantz ปีที่แล้ว

    feeding the algorithm

  • @galofloresc
    @galofloresc 2 ปีที่แล้ว +2

    Hello everyone I was hoping someone could help me with something
    in the meal problem of problem set 1 I'm running with some problems
    def main():
    time = input("What time is it: ")
    convert(time)
    if 7.0

    • @mutiuayodele607
      @mutiuayodele607 2 ปีที่แล้ว +3

      You have this error because the condition is working with the time input rather than the return value from the convert function.
      To fix this, you need to create a variant that gets the return value from your convey function and use that to check in your time conditions
      … times = convert(time)
      … if 7.0

  • @Chris-ky6ej
    @Chris-ky6ej ปีที่แล้ว

    32:48 saving it and saying downside instead hahahaha

  • @akmaraldeer
    @akmaraldeer 2 ปีที่แล้ว

    Hello, but was this course filmed?

    • @jeremyico7581
      @jeremyico7581 2 ปีที่แล้ว

      Hi is streaming this is record today

  • @ariepoco1321
    @ariepoco1321 11 หลายเดือนก่อน

    25:41

  • @mewos838
    @mewos838 2 ปีที่แล้ว

    48:21

  • @huwrw007
    @huwrw007 2 ปีที่แล้ว

    42:00

  • @yasyaindra
    @yasyaindra 4 หลายเดือนก่อน

    16:29

  • @swagsnail5881
    @swagsnail5881 ปีที่แล้ว

    25:13

  • @mr_saad3534
    @mr_saad3534 ปีที่แล้ว

    thanks

  • @KaoutarRahmoune-no2kb
    @KaoutarRahmoune-no2kb 6 หลายเดือนก่อน

    i love you

  • @satishsinghal101
    @satishsinghal101 ปีที่แล้ว

    He is wrong about that is_even function cannot be done in Java or C++, the way final version was shown in Python. Below is C++ version, which has curly braces, but code inside the function is identical to Python.
    bool is_even(int n){
    return n%2 == 0;
    }

    • @danpower7416
      @danpower7416 4 หลายเดือนก่อน

      He didn't mean returning just the boolean, he meant the ternary operator. And yes, there is a ternary operator in other C-languages, but most have the syntax: expr ? True : False as in C++ or Java. In Python it is another syntax as in the video: True if expr else False which might be syntactically easier to understand because it reads more like natural english than the ternary in most other languages. All he meant was that the syntax differs.

  • @Jeet_singh8769
    @Jeet_singh8769 ปีที่แล้ว

    The simplest code you wrote (3d one) for grading has a problem. If we will enter anything above 100 for example 999, it will still give gread A in output so better we write an if statement at starting...

  • @m00n.12.1
    @m00n.12.1 7 หลายเดือนก่อน

    8:13

  • @ShaneBurns
    @ShaneBurns 2 ปีที่แล้ว +1

    #spare fat finger typing
    # Parity.py code for modulo segment of CS50 lecture 1
    # Verbose Comments provided by Copilot AI Pair programmer
    def main(): # main function to call other functions and print results # lecture 1
    x = int(input("What is X? ")) # ask user for input
    if is_even(x): # if x is even, print this
    print("X is even")
    else: # if x is odd, print this
    print("X is odd")
    def is_even(n):
    if n % 2 == 0: # if n is even, return True
    return True # even
    else: # n % 2 != 0
    return False # if n is not even, return False
    main() # call the main function

  • @atharvasrivastava1054
    @atharvasrivastava1054 4 หลายเดือนก่อน

    6:32 i think i'm good

  • @leesumchow
    @leesumchow 2 ปีที่แล้ว +1

    Mr. Malan you are so handsome

  • @Gabgalab
    @Gabgalab 25 วันที่ผ่านมา +1

    200th comment