Exercise 2: Good Morning Sir | Python Tutorial - Day #15

Поділитися
Вставка
  • Опубліковано 3 лют 2025

КОМЕНТАРІ • 1,9 тис.

  • @CodeWithHarry
    @CodeWithHarry  2 роки тому +2229

    Attendance please! 😀

  • @sahilvashistha2647
    @sahilvashistha2647 Рік тому +889

    import time
    name = input('Enter your name: ')
    recenttime = time.strftime('%H:%M:%S')
    Recenttime = int(time.strftime('%H'))
    c= name.capitalize()
    if(4

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

      thax bro for providing solution 🤟

    • @pranshumuthreja7734
      @pranshumuthreja7734 Рік тому +21

      elif(12>=Recenttime

    • @ArijeetRoy-z4f
      @ArijeetRoy-z4f Рік тому +1

      @@pranshumuthreja7734 bhai emotion dekho words ya charecters ko nahi

    • @mr.watcherz_space
      @mr.watcherz_space Рік тому +1

      Time automatically get on then what are you going to give input after running the command

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

      Great bro can give me some tips i can give you my insta plz

  • @CodeWithHarry
    @CodeWithHarry  Рік тому +30

    Code Backup Repository: github.com/CodeWithHarry/100-days-of-code-youtube

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

      can u give some assignments at the end of every days ...it will be beneficial for learning

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

      @@arvinndmishraa5059 Harry bhai I'm absolute biggener and couldn't solve
      please help

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

    Thanks for giving us a precious skill
    import time
    a = input("Enter Your Name: ")
    timestamp = time.strftime('%H:%M:%S')
    print(timestamp)
    h = int(time.strftime("%H"))
    if (h12):
    print("Good Morning", a)
    print("I know you have no time")
    print("Goodby")
    elif (h>4 and h

  • @MOHDADILRAFEQUE-q9r
    @MOHDADILRAFEQUE-q9r Рік тому +269

    Harry bhai can you please be more elaborate about small things like import and uses of different functions because there are a lot of people who are learning to code for the first time and it will become easy for them

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

    incase if u wanna do with input:
    # use of string slicing
    # typecasting
    import time
    x= input("enter the time (24:00): ")
    y= x[0:2]
    z= int(y)
    if (z4):
    print("Good Morning !")
    elif (z==12):
    print("Good Noon !")
    elif (z12):
    print("Good Afternoon !")
    else:
    print("Good Evening !")

  • @sunilkumargupta6629
    @sunilkumargupta6629 2 роки тому +11

    import time
    hour = int(time.strftime("%H"))
    if(hour < 12 & hour == 12):
    print("Good morning Sir")
    elif(hour > 12 & hour < 17 & hour == 17):
    print("Good Afternoon Sir")
    elif(hour > 17 & hour < 19 & hour == 19):
    print("Good Evening Sir")
    elif(hour > 19 & hour == 24):
    print("Good night Sir")
    else:
    print("Some error occured")
    Bhai Thanks for this Python course ❤️ Love you Harry Bhai 🥰😘

  • @HarshAgarwal456
    @HarshAgarwal456 7 місяців тому +26

    a = int(input("Enter the time in 24hr format: "))
    if(a>4 and a=12 and a=16 and a

  • @yashpareek2487
    @yashpareek2487 9 місяців тому +51

    Short and sweet
    import time
    h=int(time.strftime('%H'))
    if h

    • @razzaq_husnain.725
      @razzaq_husnain.725 8 місяців тому

      7 is also print in your program's output with " Good Morning"

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

      Bro cant we also use input function with int so we can input our time and then get result accordingly

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

      AM aur PM ko ye program kese differentiate kare ga ?

    • @ashking569
      @ashking569 5 місяців тому +1

      @@mrsecret4567 its a 24 hr clock no no need to use am or pm

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

      @@rajdeepsingh8363
      import time
      timestamp=time.strftime("%H:%M:%S")
      print(timestamp)
      timestamp=int(time.strftime("%H"))
      #For you to practice
      timestamp=int(input("Enter the current time:"))
      if timestamp>=12 and timestamp

  • @debasishbesra2901
    @debasishbesra2901 Рік тому +19

    Day 4 of #100DayOfCode. Today in this video 15, I learned to use the time module in Python to fetch the current hour and display custom greetings like Good Morning, Good Afternoon, and Good Evening. I practiced using strftime() function to extract specific time components like hours, minutes, and seconds from the current time.
    Thank You Harry Bhaiya.

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

    import time
    hour=int(time.strftime("%H"))
    if(hour>5 and hour12 and hour

  • @vinaysingh6059
    @vinaysingh6059 2 роки тому +6

    Aap sach bhut aache aur very good teacher and Lovely person 🌹 aapne free course bhut kuch diya hai sir

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

    import time
    name=input("enter ur name:")
    hours=int(time.strftime('%H'))
    if (hours>=0 and hours=12 and hours

  • @mineashchowdhary3111
    @mineashchowdhary3111 Рік тому +23

    @codewithharry - started learning few days back and made this program on my own as you suggested.
    import time
    print("Current Time is",time.strftime("%H:%M"))
    h=int(time.strftime("%H"))
    m=int(time.strftime("%M"))
    if(h

    • @SaiGamer24
      @SaiGamer24 10 місяців тому +1

      bhai plz mujhe samjha do ki hume pata kaise chalega ki python me kansa module hai aur konsa hume khud hi banana hoga?? please reply😭😭😭😭

    • @cruelfarter9976
      @cruelfarter9976 10 місяців тому +1

      @SaiGamer24 bhai mujhe bhi wahi nahi samajh raha 😢

    • @SaiGamer24
      @SaiGamer24 10 місяців тому +1

      @@cruelfarter9976 vai mene thode aur bando se pucha tha toh simply hume just google karna padega modules ke baare me aur commands ke liye vo replit ka auto wala bata deta hai

    • @cruelfarter9976
      @cruelfarter9976 10 місяців тому +1

      @@SaiGamer24 accha !!

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

      Then why to watch this video at all simply learn from google​@@SaiGamer24

  • @ShivajiPalve-yu9ng
    @ShivajiPalve-yu9ng День тому +1

    import time
    timestamp = time.strftime('%H:%M:%S')
    print("The current time is")
    print(timestamp)
    current_hour = int(time.strftime("%H"))
    if current_hour > 5 and current_hour < 12:
    print("Good morning Sir!")
    elif current_hour > 11 and current_hour < 18:
    print("Good Afternoon Sir")
    elif current_hour > 17 and current_hour < 21:
    print("Good evening Sir")
    else:
    print("Good night Sir")
    I made it!!❤

  • @Thinker-360
    @Thinker-360 2 роки тому +55

    import time
    str=input('Enter your name : ')
    hours = int(time.strftime('%H'))
    if(hours>=0 and hours=12 and hours

    • @NONE-CODE
      @NONE-CODE 2 роки тому +4

      thanks bro now i understand how to do and how its work

    • @pandaalways113
      @pandaalways113 2 роки тому +2

      Thanks

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

      very helpful and easy to understand thanks😍😍😍😍😍😍😍

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

      Thankyou brother.

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

      int(input("Enter the value of A: "))
      if(A==0000):
      print("MidNight")
      elif(A

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

    time=int(input())
    if(1

  • @AbdulSalam-pv6es
    @AbdulSalam-pv6es 2 роки тому +130

    I'm 14 years old and learned Python (learning again so I can learn new topics), Django, Html, CSS, Java Script, Java, C++, C, My SQL from this man.... #harrybhai #thankyoufortutorials

    • @ajeetverma3936
      @ajeetverma3936 2 роки тому +5

      Kaha se sikhe

    • @AbdulSalam-pv6es
      @AbdulSalam-pv6es 2 роки тому +14

      @@ajeetverma3936 Code with harry se or apna college se bhi sikha hai. #apnacollege #codewithharry

    • @KoushikDas2005
      @KoushikDas2005 2 роки тому +13

      @Armaan Dutt Sharma bhai yeh sab bol Dene se naukri nahi mil jayegi thoda apna bachpan v jee liya karo .....abhi main yeh class 11 mein seekhke 12 mein firse kr rha aur yeh mere kaam aa rha
      Aur tum log ka kuch nahi kaam aa rha
      Sirf yt videos dekhke bina qs kiye program nahi seekh jaate ..... #9YearsAudience

    • @KoushikDas2005
      @KoushikDas2005 2 роки тому +4

      @Armaan Dutt Sharma han bhai theek hai but age mat bata itna baar ik u r a kid and tera mann karta hoon hoga yeh sab karne but na karke bina comment kiye karega toh soch kitna Kam energy tera waste hoga

    • @AnksioXD
      @AnksioXD 2 роки тому +52

      i was born 3 hours ago my current occupation is of a rocket scientist at nasa and space x

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

    ct = datetime.datetime.now().time()
    tat = datetime.time(12, 0, 0)
    if (ct

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

    import time
    name = input("Enter your name: ")
    current_time = time.strftime('%H:%M:%S')
    print(name.capitalize(),"your current time is :",current_time)
    def greet(h):
    if h > 6 and h < 12:
    print("Hello",name.capitalize(),"Good morning!")
    elif h >= 12 and h < 17:
    print("Hello",name.capitalize(),"Good Afternoon!")
    elif h >= 17 and h < 21:
    print("Hello",name.capitalize(),"Good Evening!")
    else:
    print("Hello",name.capitalize(),"Good night!")
    h = int(time.strftime('%H'))
    greet(h)
    Thanks!! for such a nice course.

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

    Am a medical student but wanted to learn programming , you told us to make this exercise using if and else and i made with that for example if time < 9 its good morning , elif time== 12 its afternoon
    (Jesy apne bnaya wese tu ata hi ni bnana)

  • @deepanshu401
    @deepanshu401 2 роки тому +2

    import time as t
    b =int(t.strftime("%H"))
    if b>=5 and b=12 and b=18 and b

  • @shahbaznoor8718
    @shahbaznoor8718 8 місяців тому +3

    Here's the code without changing the time into integers. I had used nested if-else condition just to make it more challenging, you guys can skip that part if you want to. Hope it will help you guys. Cheers
    import time
    time= time.strftime('%H:%M:%S')
    print(time)
    if (time>='06:00:00' and time

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

    import time
    timestamp = time.strftime("%H:%M:%S") # Main module to extract time.
    if (timestamp >= "00:00:00" and timestamp = "12:00:00" and timestamp

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

      The only correction here is for else statement, we should not use curly braces.

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

      @@saiteja2425 Curly braces? Where did I use curly braces?

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

    I took
    00:00 to 11:59 as morning
    12:00 to 16:59 as aftrenoon
    17:00 to 22:00 as evening
    and else as good night
    # programme which shows which type of greet youshould prefer at that time
    import time
    h = int(time.strftime('%H'))
    m = int(time.strftime('%M'))
    s = int(time.strftime('%S'))
    print(h)
    print(m)
    if(h==0 or h0 and m0 and s=12 and h0 and m0 and s=17 and h0 and m0 and s

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

      I had done this |
      V
      import time
      b = int(time.strftime("%M"))
      a = int(time.strftime("%H"))
      if a >= 22:
      print("Good Night")
      elif a < 5:
      print("Good Night")
      elif 5

    • @DAILYHOOD.S
      @DAILYHOOD.S 9 місяців тому

      👏

    • @AmeenaBi-vc8iq
      @AmeenaBi-vc8iq 3 місяці тому

      Thank you so much dear this program helped to understand this concept soo well

  • @Soham_Posts
    @Soham_Posts 2 місяці тому +1

    import time
    h = int(time.strftime("%H"))
    print(h)
    if h>=4 and h=12 and h17 and h

  • @abnarwal
    @abnarwal 2 роки тому +23

    import time
    timestamp = time.strftime('%H:%M:%S')
    hourshand = int(time.strftime('%H'))
    minuteshand = int(time.strftime('%M'))
    secondshand = int(time.strftime('%S'))
    print(timestamp)
    # 06:00:00 to 11:59:59 - Morning
    # 12:00:00 to 16:59:59 - Afternoon
    # 17:00:00 to 21:59:59 - Evening
    # 22:00:00 to 05:59:59 - Night
    if 5==hourshand or hourshand

  • @noobgamerankit9033
    @noobgamerankit9033 10 місяців тому +1

    import time # module to get time
    # variable defining time
    timenow = int(time.strftime('%H'))
    if timenow >0 and timenow 12 and timenow

  • @ishtiaqahmed9829
    @ishtiaqahmed9829 Рік тому +65

    # Morning time zone starts at 04:00:00 to 11:59:59
    # Afternoon time zone starts at 12:00:00 to 15:59:59
    # Evening time zone starts at 16:00:00 to 19:59:59
    # Night time zone starts at 20:00:00 to 24:59:59
    import time
    name = input("Enter your name Sir: ").title() #It is used to capitalize the first letter
    current_time = time.strftime('%H:%M:%S') #strftime is used to get the current hour of the day from the system's time
    print(current_time)
    hour = int(time.strftime('%H'))
    if hour = 12 and hour < 15:
    print("Good Afternoon",name)
    elif hour >= 15 and hour < 19:
    print("Good Evening",name)
    else:
    print("Good Night",name)

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

      Thanks bro for that use of string method (title () )
      I was thinking that to use string method we have create a variable first then print it with .string method
      Now I can use it directly without a variable ❤

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

      its wrong. run your code at 5am in the morning, you'll understand why. :)

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

      why bro@@hritamchakraborty707

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

      It should be >=4 to print good morning

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

    print("Enter the current hour
    ")
    a=int(input())
    print("Enter the am/p'
    ")
    c=input()
    if(a

  • @mdsohanurrahmanhridoy1343
    @mdsohanurrahmanhridoy1343 2 роки тому +9

    #Quiz 2 -->#GOOD MORNING-->
    import time
    name = input("Enter Your name : ").title()
    currentTime = time.strftime('%H:%M:%S')
    h = int(time.strftime('%H'))
    if(h12 and h

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

    import time
    name=input("enter your name ")
    h=int(time.strftime("%H"))
    if(h=5):
    print("good morning",name)
    elif(h>=12 and h=17 and h

  • @nehasrivastava4486
    @nehasrivastava4486 2 роки тому +59

    import time
    # Morning Time : 04:00:00 to 11:59:59
    # Afternoon Time : 12:00:00 to 16:59:59
    # Evening Time : 17:00:00 to 20:59:59
    # Night Time : 21:00:00 to 03:59:59
    name = input("Enter Your Name:- ").title()
    # currentTime = time.strftime('%H:%M:%S')
    # print(currentTime)
    hour = int(time.strftime('%H'))
    if 4

    • @Unknown-ey4wn
      @Unknown-ey4wn 2 роки тому

      Waah didi waah.

    • @nitishbahuguna1725
      @nitishbahuguna1725 2 роки тому +2

      raat ka 1 bje good morning kon bolta h

    • @dashstar33
      @dashstar33 2 роки тому +3

      Didi aap thoda code galath likhe hue ho jise if 4 >= hour

    • @dashstar33
      @dashstar33 2 роки тому +1

      And aur ek statement current time=int(timestamp.strftime('%h:%m:%s')

    • @nehasrivastava4486
      @nehasrivastava4486 2 роки тому +1

      @@dashstar33 maine likha hai hour jb 4 se bda ya brabar ho and 12 se chhota ho

  • @deeniaat
    @deeniaat 2 місяці тому +2

    test=str(input("whats the time"))
    if (test=="12:00 am"):
    print("Good morning bro")
    if (test=="9:00 am"):
    print("good evening")
    elif (test=="12:00 pm"):
    print("good night")
    else:
    print("your are doing soethng wrong")

  • @vansh_sethi
    @vansh_sethi 2 роки тому +10

    import time
    '''
    timestamp = time.strftime('%H:%M:%S')
    print(timestamp)
    hrs = time.strftime('%H')
    print(hrs)
    mins = time.strftime('%M')
    print(mins)
    secs = time.strftime('%S')
    print(secs)
    '''
    '''
    Morning - 04:00:00 to 12:00:00
    Afternoon - 12:00:00 to 16:59:59
    Evening - 17:00:00 to 20:59:59
    Night - 21:00:00 to 03:59:59
    '''
    name = input("Enter your name - ")
    hour = int(time.strftime('%H'))
    if 4

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

    This exercise made me learn a lot! Like, how does the time function work, the difference in using the logical operators in other languages like C and Java compared to Python, etc etc.. Here's my attempt:
    import time
    hour = int(time.strftime('%H'))
    if hour10 and hour18 and hour

    • @AdityaPatil-ii4xz
      @AdityaPatil-ii4xz 11 місяців тому

      you should also use minutes and seconds, it wil give you wrong output if you run the code at 10, 18 or 21 hrs

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

    Exercise 2: Good Morning Sir
    tell = int(input("enter your message : "))
    timestamp = time.strftime ('%H:%M:%S')
    print(timestamp)
    timestamp = int(time.strftime ('%H'))
    print(timestamp)
    timestamp = int(time.strftime('%M'))
    print(timestamp)
    timestamp = int(time.strftime('%S'))
    print(timestamp)
    if (tell < 12):
    print("Good morning sir")
    elif (tell

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

    import time
    currenttime = int(time.strftime("%H"))
    print(currenttime)
    if(currenttime>4 and currenttime =12 and currenttime=16 and currenttime

  • @sufiyanmogal1527
    @sufiyanmogal1527 Рік тому +14

    # Morning time zone starts at 04:00:00 to 11:59:59
    # Afternoon time zone starts at 12:00:00 to 15:59:59
    # Evening time zone starts at 16:00:00 to 19:59:59
    # Night time zone starts at 20:00:00 to 24:59:59
    import time
    name = input("Enter your Name: ").title()
    hours = int(time.strftime("%H"))
    if(hours>=4 and hours=12 and hours=16 and hours

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

      Bro shayad ek problem hai ismai agar hours=12 par tumhe vo good afternoon bhi wish karega

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

      @@Anshpratap_editing sorry mene notice nhi kiya mene sahi kiya but edit krna bhul gya thanks batane ke liye

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

      @@Rahuleditor80 good night

    • @nikhilmishra9455
      @nikhilmishra9455 11 місяців тому +1

      gg

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

    import time
    timeslap=time.strftime('%H:%M:%S')
    print(timeslap)
    Hours=int(time.strftime('%H'))
    print(Hours)
    if (12>Hours):
    print("Good morning sir")
    elif (Hours>=22):
    print("Good night sir")
    elif (16=20):
    print("Good evening sir")
    else:
    print("Good afternoon sir")

  • @YashMalhotra13
    @YashMalhotra13 2 роки тому +5

    Harry bhai i stuck a lot in this exercise but after taking help from google and some of your comments i finally complete this but really i stuck a lot in this
    # Morning Time : 04:00:00 to 11:59:59
    # Afternoon Time : 12:00:00 to 16:59:59
    # Evening Time : 17:00:00 to 20:59:59
    # Night Time : 21:00:00 to 03:59:59
    import time
    currentTime = time.strftime('%H:%M:%S')
    current_hour=time.strftime('%H')
    if(current_hour>="4" and current_hour="12" and current_hour="17" and current_hour

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

      this is very late but you can also convert current hour to int then compare normally

  • @karthikmudgal8410
    @karthikmudgal8410 2 роки тому +1

    import time
    Time = time.strftime('%H:%M:%S')
    print(Time)
    hours = time.strftime('%H')
    print(hours)
    mins = time.strftime('%M')
    print(mins)
    sec = time.strftime('%S')
    print(sec)

  • @adityagupta2884
    @adityagupta2884 2 роки тому +49

    # Quiz 2
    # I may be a little late in this but here we go
    import time
    timestamp = time.strftime('%H:%M:%S')
    print("The time right now is",timestamp)
    hours = int(time.strftime('%H'))
    if hours >= 0 and hours 12 and hours < 17:
    print("Good Aternoon Captain")
    elif hours > 17 and hours < 20:
    print("Good Evening Captain")
    else:
    print("Good Night")

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

      do you live in delhi

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

      Same aaj mera 5th day h lekin ye solve ho nhi ho raha

    • @SaiGamer24
      @SaiGamer24 10 місяців тому +1

      bhai plz mujhe samjha do ki hume pata kaise chalega ki python me kansa module hai aur konsa hume khud hi banana hoga?? please reply😭😭😭😭

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

      @@SaiGamer24 u can look for inbuilt modules in python {inbuilt modules are the ones present in python you can directly import them

    • @abhassharma6491
      @abhassharma6491 10 місяців тому +1

      ​@@SaiGamer24 practice se, jab sari class ho jayegi to mostly sb pata chal jayega jitni practice karoge utne achche hote jaoge

  • @mysterydoor7605
    @mysterydoor7605 2 роки тому +4

    Exercise answer:
    import time
    timestamp=time.strftime('%H%M%S')
    time2=int(time.strftime('%H%M%S'))
    print("The present time is",time2)
    if time2>=60000 and time2=120000 and time2=170000 and time2=210000 and time

  • @HamzaMdAli509B
    @HamzaMdAli509B 26 днів тому

    import time
    timestamp=time.strftime('%H:%M')
    print("The Time Currently is: ",timestamp)
    a=int(time.strftime("%H"))
    if(a

  • @varshasingh2715
    @varshasingh2715 2 роки тому +37

    import time
    timestamp = time.strftime('%H:%M:%S')
    print(timestamp)
    name = input("Enter your name: ")
    hours = int(time.strftime('%H'))
    if(0

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

      ​@MuhammadRashid-be9xwo

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

      Bhai, 11 and 12 ke beech me undefined hai. aur bhi thora modify karlo

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

      @@vineetsinha4908 defined toh hai na? wo equal to operator bhi toh laga hai

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

      @@alien6378 bro, to batao 11:30 me kya print hoga, kaha defined hai

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

      import time
      timestamp=time.strftime('%H:%M:%S')
      if(timestamp='12:00:00' and timestamp='17:00:00' and timestamp='21:00:00' and timestamp

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

    import time
    timestamp = time.strftime('%H:%M:%S')
    print(timestamp)
    timestamp = int(time.strftime('%H'))
    if (timestamp >= 17 & timestamp < 00):
    print("Good Evening")
    elif (timestamp >= 12 & timestamp

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

    He is explaining only to those who have already learnt it and are again revising

    • @anonymous8800.
      @anonymous8800. 7 місяців тому +4

      Bro i have no idea about strftime , it's new for me

  • @JahangirAbbas-zv6uu
    @JahangirAbbas-zv6uu 2 місяці тому

    a=int(input("enter a time"))
    print("the time is:", a )
    if(a9 and a=13 and a=17 and a

  • @dittodolls7602
    @dittodolls7602 Рік тому +15

    According to ChatGPT:-
    The timing for greetings like "Good morning", "Good afternoon", "Good evening", and "Good night" can vary based on cultural norms and personal preferences. Here's a general breakdown:
    Good Morning: Typically used from around 5 AM until around 12 PM (noon).
    Good Afternoon: Usually used from around 12 PM (noon) until around 4 PM.
    Good Evening: Commonly used from around 4 PM until around 8 PM.
    Good Night: Typically used when it's time to go to bed, which can vary widely depending on personal habits. It's often used when it gets dark or before someone goes to sleep.
    Code made by using the above information:-
    import time
    h = int(time.strftime("%H"))
    if 5

    • @notNEYMARjr.
      @notNEYMARjr. Рік тому +1

      BUT MY TIME FORMAT IS 12 HOUR NOT 24 HOURS

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

      @@notNEYMARjr. its ok no prblm dude !

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

    This was a little bit difficult exercise for me but finally, I did it first I felt shameful because I watched the complete video but still didn't find an answer to solve it i don't know this will perform perfectly all the time but this time it's working
    import time
    h=int(time.strftime("%H"))
    m=int(time.strftime("%M"))
    if(h

  • @tieltales
    @tieltales 7 місяців тому +5

    We are completely new in programming. I watched your lectures from 1-15 but aapne kahi time module nahe parrhaya and aap ne achanak se exercise dedi..

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

      bro i am also new but i did it

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

      @@AkhandCoder there is a difference between understanding and copying a code ! lol . he didnt actually taught the meaning of specific words ; how and where is it used. so better keep quite

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

      @@youthoob3573 yup

  • @mr.ultimatek
    @mr.ultimatek 4 місяці тому +1

    # I did it myself, No Time Module Used since it wasn"t taught till this Day's Video
    a=int(input("Enter the Time, in hour : "))
    if(a=12):
    print("Good Afternoon")
    elif(a>=4):
    print("Good Morning")

    • @mr.ultimatek
      @mr.ultimatek 4 місяці тому

      # Program with TimeModule
      import time
      timestamp=time.strftime('%H:%M:%S')
      print(timestamp)
      timehour=int(time.strftime('%H'))
      #timehour=int(input("Enter your Time Hour: "))
      print(timehour)
      if(timehour

  •  2 роки тому +12

    Done Before Watching sir.
    Actually I didn't know about that time method so i took time as user input separated by spaces and then Split it. Then I took the 1st index which is hour and converted it into int.

    • @yashwishah3408
      @yashwishah3408 2 роки тому +1

      can you pls write that program in comment section

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

      ​​@@yashwishah3408I have not used the split funciton but, have used the if else statements. I'll send it here if you want
      (Ik I'm very late lol)

  • @saptarshi014
    @saptarshi014 11 місяців тому +1

    # Good Morning Sir
    import time
    t1=time.strftime('%H %M %S')
    t2=time.strftime('03H 59M 59S')
    t3=time.strftime('11H 59M 59S')
    t4=time.strftime('15H 59M 59S')
    t5=time.strftime('18H 59M 59S')
    if(t2

  • @jeetshing9611
    @jeetshing9611 Рік тому +12

    This is my code:-
    a = int(input("Enter a time :-"))
    if(a

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

    import time
    timestamp= time.strftime("%H:%M:%S")
    print(timestamp)
    t= int(time.strftime("%H"))
    if t > 00 and t < 12:
    print("Good morning")
    elif t >=12 and t =17 and t < 24:
    print("Good evening")
    else:
    print("ok")

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

    mine is simple and beautiful-
    import time
    tim = time.strftime('%H : %M : %S')
    print(tim)
    if tim = '5:00:00':
    print("Good Morning")
    elif tim '12:00:00':
    print("Good After Noon")
    elif tim '18:00:00':
    print('Good Evening')
    elif tim '21:00:00':
    print("Good Night")
    else:
    print("Good Middle Of Night")

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

    import time
    a=time.strftime("%H")
    b=int(a)
    if (b=4):
    print("Good Morning")
    elif (b=12):
    print("Good Afternoon")
    elif(b=18):
    print("Good Evening")
    else:
    print("Good night")

  • @milestips
    @milestips 2 роки тому +20

    # Exercise 2: Good Morning Sir
    # Greet, According to Time
    # morning - 5 to 12
    # afternoon - 12 to 17
    # evening - 17 to 21
    # night - 21 to 4
    # solution
    import time
    t = time.localtime()
    current_time = time.strftime("%H:%M:%S", t)
    current_hour = int(time.strftime("%H", t))
    if 5

    • @natureinsky2963
      @natureinsky2963 2 роки тому +1

      thanks!

    • @milestips
      @milestips 2 роки тому +1

      @@natureinsky2963 welcome my brother 🤗

    • @aadhaya200
      @aadhaya200 2 роки тому +1

      But muje lag rha he ....sir ne itana padhaya hi nhi he .... like {} ye kese use kiya or kab karte he ?

    • @milestips
      @milestips 2 роки тому +2

      @@aadhaya200 Yeh f-strings hai, python ke pehle course mai pdya hai ye. es ki help se hum string mai easily variable ki value likh skte hai. For example: name = "Godlike"
      -> 1st way
      print("Your name is "+name")
      -> 2nd way
      print(f"Your name is {name}")
      aur tarike hai yr variable ki value ko likhne ke liye. jise .format() bhi hai ek aage pdye gye bhaiya.

    • @aadhaya200
      @aadhaya200 2 роки тому

      @@milestips thank you bhaiya 😊

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

    import time
    '''
    Morning Time: 4 to 12
    Afternoon Time: 12 to 17
    Evening Time: 18 to 20
    Night Time: 21 to 3
    '''
    time1 = time.strftime('%H:%M:%S')
    print(time1)
    tp = int(time.strftime('%H'))
    if tp >= 4 and tp 12 and tp 17 and tp

  • @Stump.Diaries
    @Stump.Diaries Рік тому +6

    I had written a code for exercise 2 in which we have to enter time and name
    a = int(input("What is time right now? (Must be in 24 hour format and only hour "))
    b = input("Write your name: ")
    if(a12 and a16 and a21 and a

  • @khushiMotivationWorld
    @khushiMotivationWorld 2 роки тому +4

    Best ever sir thank you so much sir 🙏❤️

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

    import time
    a = int(time.strftime("%H"))
    if(a>=4 and a=12 and a=17 and a

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

    Solution of exercise : -
    print("Hello and welcome to excersice number two ")
    import time
    t1=time.strftime('%H:%M:%S')
    print(t1)
    t2=time.strftime('%H')
    print("Hours is :",t2)
    t3=time.strftime('%M')
    print("Minutes is :",t3)
    t4=time.strftime('%S')
    print("Second is :",t4)
    # Good Morning Sir #
    n = input("Enter your name sir : ")
    h = int(time.strftime('%H'))
    if (5

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

    h=int(input("enter the time (hr hand)"))
    r=int(input("enter the time (min hand)"))
    time=(h,':',r)
    if h>3 and r>1 and h11 and r>1 and h< 16:
    print("good afternoon")
    elif h>16 and r>1 and h

  • @amitranjeetjha1240
    @amitranjeetjha1240 2 роки тому +4

    This course is awesome 🔥🔥

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

    import time
    time = time.strftime('%H:%M:%S')
    print(time)
    if (time >= '00:00:00' and time = '12:00:00' and time

  • @mithileshyadav9627
    @mithileshyadav9627 2 роки тому +5

    Bhai I have completed your previous 12 hr course of python but still I'm doing this series for my revision

    • @SaiGamer24
      @SaiGamer24 10 місяців тому +1

      bhai plz mujhe samjha do ki hume pata kaise chalega ki python me kansa module hai aur konsa hume khud hi banana hoga?? please reply😭😭😭😭

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

    tm = float(input("Current time is : "))
    if ( tm = 12 and tm

  • @guitarician111
    @guitarician111 2 роки тому +8

    user_time = int(input("Enter the time sir : "))
    if user_time>6 and user_time12 and user_time17 and user_time21 and user_time

  • @dhansujatt3944
    @dhansujatt3944 23 дні тому

    import time
    now = str(time.ctime())
    if(int(now[11:13])>0 and int(now[11:13])12 and int(now[11:13])

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

    Without using the time module:
    time = int(input("Enter the time in 24 hour format: "))
    if (time in range (1,12)):
    print("good morning")
    elif(time in range (13,15)):
    print("Good afternoon")
    elif (time in range (16,20)):
    print("good evening")
    elif (time in range (20,25)):
    print("good night")
    else:
    print("enter valid time between 1-24")

  • @lastbullet_official
    @lastbullet_official 5 місяців тому +1

    solution:
    import time
    hour = int(time.strftime('%H'))
    if hour < 12:
    print('Good Morning Sir!')
    else:
    print('Good afternoon Sir!')

  • @oo-tes6642
    @oo-tes6642 2 роки тому +4

    Solution to exercise, I have also displayed time in 12 hour format ✌️ %I for 12 hour aur %p for am/pm
    Code :
    # exercise 2
    import time
    name = input("What's Your Name ?
    ")
    local_time = time.strftime('%H:%M:%S')
    twelve_hour_format = time.strftime('%I:%M:%S:%p')
    print(twelve_hour_format)
    if local_time < '12:00:00':
    print("Good morning", name)
    elif local_time < '17:00:00':
    print("Good afternoon", name)
    else:
    print("Good evening", name)
    Edit : aur jaise app ne bola ki int mai convert Karo , lakin maine socha aur maine condition ko he string Mai likh dia 🧠😂

  • @ranakashif8765
    @ranakashif8765 10 днів тому

    time = float(input("Enter the Time"))
    if(time>0.00 and time12.00 and time17.00 and time

  • @intezarkhan889
    @intezarkhan889 2 роки тому +4

    # 24 Hours Timing
    # import time
    # timestemp = time.strftime('%H:%M:%S')
    # print(timestemp)
    # timestemp = int(time.strftime('%H'))
    # print(timestemp)
    # timestemp = int(input('Enter Time (1-24):'))
    # if(timestemp>=0 and timestemp=4 and timestemp=10 and timestemp=16 and timestemp21 and timestemp=1 and t4 and t7 and t=1 and t4 and t10 and t

    • @harshitpandey4284
      @harshitpandey4284 2 роки тому

      in last elif change am to pm...and in 2nd elif chnge pm itno am☺️

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

    Actually It is according to my routine so it might be a little bit of different: import time
    # Morning Time : 4 am to 11 pm
    # noon Time :11 pm to 5pm
    # Evening Time : 6 pm to 7 pm
    # Night Time : 7 pm to 3 am
    code ++
    import time
    a=time.strftime('%H')
    b=int(a)
    if b>=0 and b

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

    a = int(input("Enter the number when you woke up: "))
    if(a>=5 and a10 and a

  • @sarthakrastogi8622
    @sarthakrastogi8622 2 роки тому +5

    Harry Bhai please DSA IN JAVA ki playlist banado.

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

    import time
    x=time.strftime("%H:%M:%S")
    print("Current Time is: ",x)
    y=time.strftime("%H")
    z=time.strftime("%M")
    if (int(y)

  • @54i25
    @54i25 Рік тому +7

    By using %H, you will get the time in 24hour format, even if you change it to python3, I would recommend using %I, this will give the time in 12 hour format

    • @ashir...897
      @ashir...897 Рік тому +2

      its so much easier with 24 hour format

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

    Hello sir I'm 13 and studing in class 9
    Learing Python from you is so much amazing.
    here the the solution:
    import time
    tdm = int(time.strftime('%H'))
    if (tdm > 0 and tdm = 12 and tdm

  • @vanditjambu
    @vanditjambu 2 роки тому +8

    #a = input("Hello")
    # timestamp = time.strftime('%H:%M:%S')
    # print(timestamp)
    # timestamp = time.strftime('%H')
    # if(int(timestamp) >= 5 and int(timestamp)

  • @dhruvpatel7384
    @dhruvpatel7384 2 роки тому

    import time
    curr = time.strftime('%H')
    curr = int(curr)
    if curr 12:
    print("Good Morning Sir")
    elif curr = 5:
    print("Good Afteroon Sir")
    else:
    print("Good Evening Sir")

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

    import time
    # Get the current time in HH:MM:SS format
    current_time = time.strftime('%H:%M:%S')
    # Define time ranges as strings
    start_time = "04:00:00"
    mid_time1 = "11:59:59"
    mid_time2 = "12:00:00"
    mid_time3 = "15:59:59"
    end_time = "16:00:00"
    end_time1 = "03:59:59"
    # Determine the greeting based on the current time
    if start_time

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

    bhai adhe ghante examples dekh dekh ke banaya hai finally ban gyaa
    i am satisfied....
    name=(input("enter the name : " ))
    print( "Hello", name)
    import time
    timestamp= time.strftime("%H:%M:%S")
    print("time: ", timestamp)
    hour = int(time.strftime("%H"))
    if ( 5

  • @Anmol-dhimann
    @Anmol-dhimann Рік тому +1

    time = int(input("enter the time"))
    if(time = 1):
    print("good morning sir ", time)
    elif(time>=13 and time =17 and time

  • @saiyadrushan1763
    @saiyadrushan1763 Рік тому +8

    hope you like it :)
    import time
    morning=",good morning, sir"
    afternoon=",good after noon,sir"
    evening=",good evening, sir"
    x=input('enter your name sir : ')
    print('welcome,',x,'sir')
    print('do you wanna what time it is?')
    y=input('=')#only yes is acceptable
    print('its time for you to study')
    print('kidding,sir')
    hour=int(time.strftime("%H"))
    if(17>=hour>=12):
    print('its',hour,afternoon)
    elif(0

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

    a = int(input("Enter current time: "))
    print("Your current time is", a)
    if (a>=6 and a=12 and a=16 and a

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

    Hi Harry, it will be great if you could add one video specifically on how to use module and read its documentation from python page. There are multiple functions but which one to use and how to use it.

  • @Bil-gg5xv
    @Bil-gg5xv 6 місяців тому

    easy
    import time
    ts = time.strftime("%H:%M:%S")
    print(ts)
    if (ts < "12:00:00"):
    print("Good Morning")
    elif (ts > "12:00:00" and ts < "18:00:00"):
    print("Good Afternoon")
    else:
    print("Good Evening")

  • @sandeepsen3337
    @sandeepsen3337 2 роки тому +9

    Present bhaiya💜

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

    time1 = int(input())
    if time1

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

    a = int(input('enter the value'))
    if a>0 and a12 and a16 and a20 and a

  • @teamiqagentbgmi3125
    @teamiqagentbgmi3125 2 роки тому

    import time
    a=time.strftime("%T")
    print(a)
    if (a

  • @HariCharan27
    @HariCharan27 7 місяців тому +4

    I am not understanding anything why did u use time and what is it u didnt even explain it in prev videos😢😢😢😢😢

    • @ShashwatChaudhary-ti4fk
      @ShashwatChaudhary-ti4fk 4 місяці тому

      bro module import karake uske strf function ka use kia h jaise squareroot nikalte time maths module import kra k sqrt function use krte h

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

    import datetime as time
    Time = time.datetime.now().hour
    min = time.datetime.now().minute
    if Time=12:
    print("good afternoon!")
    elif Time>19:
    print("good night")

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

    import time
    H = int(time.strftime("%H", time.localtime()))
    if H>=12 and H=16 and H=20 and H=0 and H

  • @perusamulasaikumar4527
    @perusamulasaikumar4527 2 роки тому +5

    import time
    # Taking input from the user
    name = input("Enter your name:")
    time = int(input("Enter the time : "))
    # Checking condition 00 : 00 : 00 to 24 : 00 : 00 hours
    # 24 hours format....
    # from morning 12 to afternoon 12
    if time > 0 and time < 12:
    print("Good Morning Sir")
    print("Go to UA-cam and search codewithharry channel and subsribe channel :)")
    print("Please join the challenge of 100 days to code ")
    print("I am a big fan of you bhai..")
    print("This is time to watch videos of harry bhai of python 100 days to code")
    # from afternoon 12 to afternoon 16
    elif time > 12 and time < 16:
    print("Good Afternoon Sir")
    print("This is time to practice code you have seen in harry bhai channel")
    # from evening 16 to evening 19
    elif time > 16 and time < 19:
    print("Good evening Sir")
    print("Time to write code by your own way")
    # from night 19 to night 24
    elif time > 19 and time

    • @arpankarmakar16
      @arpankarmakar16 2 роки тому +1

      bro where did you use the time module you just imported it

    • @hafizaatiya
      @hafizaatiya 2 роки тому

      thank you you explained very well

    • @hafizaatiya
      @hafizaatiya 2 роки тому

      thank you bhai you explain very well