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
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
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 !")
@@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
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.
@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
@@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
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
@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
@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
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.
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)
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
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
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
# 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)
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 ❤
#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
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
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
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
# 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
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
# 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")
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
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
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
@@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
# 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")
# 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.
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")
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")
# 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
@@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.
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
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
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
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
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")
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 🧠😂
# 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
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
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
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
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
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
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
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.
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")
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
Attendance please! 😀
Present sir. 😁
Present sir...
Present bro 🤚
present sir
Present sir
import time
name = input('Enter your name: ')
recenttime = time.strftime('%H:%M:%S')
Recenttime = int(time.strftime('%H'))
c= name.capitalize()
if(4
thax bro for providing solution 🤟
elif(12>=Recenttime
@@pranshumuthreja7734 bhai emotion dekho words ya charecters ko nahi
Time automatically get on then what are you going to give input after running the command
Great bro can give me some tips i can give you my insta plz
Code Backup Repository: github.com/CodeWithHarry/100-days-of-code-youtube
can u give some assignments at the end of every days ...it will be beneficial for learning
@@arvinndmishraa5059 Harry bhai I'm absolute biggener and couldn't solve
please help
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
Strf.time function ka bta dyn??
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
actually yes this tough
Yes, thats right
True
Yes
This popped up real quick he didn't taught import and time thing
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 !")
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 🥰😘
Kaha se chaapa
@@vinitgharat2333 😁😁👀👀
30 pr v goodnight
🙏🙏🙏🙏
It will give no output at 5 o clock .12 0 clock pm and 7 o clock
a = int(input("Enter the time in 24hr format: "))
if(a>4 and a=12 and a=16 and a
THANK U
i did the same way
pr bahi time b to import krna tha isme
Short and sweet
import time
h=int(time.strftime('%H'))
if h
7 is also print in your program's output with " Good Morning"
Bro cant we also use input function with int so we can input our time and then get result accordingly
AM aur PM ko ye program kese differentiate kare ga ?
@@mrsecret4567 its a 24 hr clock no no need to use am or pm
@@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
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.
import time
hour=int(time.strftime("%H"))
if(hour>5 and hour12 and hour
Its very easy
@@hinataa_chann
Aap sach bhut aache aur very good teacher and Lovely person 🌹 aapne free course bhut kuch diya hai sir
import time
name=input("enter ur name:")
hours=int(time.strftime('%H'))
if (hours>=0 and hours=12 and hours
@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
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😭😭😭😭
@SaiGamer24 bhai mujhe bhi wahi nahi samajh raha 😢
@@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
@@SaiGamer24 accha !!
Then why to watch this video at all simply learn from google@@SaiGamer24
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!!❤
import time
str=input('Enter your name : ')
hours = int(time.strftime('%H'))
if(hours>=0 and hours=12 and hours
thanks bro now i understand how to do and how its work
Thanks
very helpful and easy to understand thanks😍😍😍😍😍😍😍
Thankyou brother.
int(input("Enter the value of A: "))
if(A==0000):
print("MidNight")
elif(A
time=int(input())
if(1
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
Kaha se sikhe
@@ajeetverma3936 Code with harry se or apna college se bhi sikha hai. #apnacollege #codewithharry
@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
@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
i was born 3 hours ago my current occupation is of a rocket scientist at nasa and space x
ct = datetime.datetime.now().time()
tat = datetime.time(12, 0, 0)
if (ct
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.
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)
import time as t
b =int(t.strftime("%H"))
if b>=5 and b=12 and b=18 and b
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
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
The only correction here is for else statement, we should not use curly braces.
@@saiteja2425 Curly braces? Where did I use curly braces?
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
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
👏
Thank you so much dear this program helped to understand this concept soo well
import time
h = int(time.strftime("%H"))
print(h)
if h>=4 and h=12 and h17 and h
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
and operator ka use hai
@@rishikesh86 '&&' is used in place of and
import time # module to get time
# variable defining time
timenow = int(time.strftime('%H'))
if timenow >0 and timenow 12 and timenow
# 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)
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 ❤
its wrong. run your code at 5am in the morning, you'll understand why. :)
why bro@@hritamchakraborty707
It should be >=4 to print good morning
print("Enter the current hour
")
a=int(input())
print("Enter the am/p'
")
c=input()
if(a
#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
Thank u 💓
Not working
@@kattar_hindu. Bro check it again
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
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
Waah didi waah.
raat ka 1 bje good morning kon bolta h
Didi aap thoda code galath likhe hue ho jise if 4 >= hour
And aur ek statement current time=int(timestamp.strftime('%h:%m:%s')
@@dashstar33 maine likha hai hour jb 4 se bda ya brabar ho and 12 se chhota ho
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")
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
thanks bro👍
thanks bro
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
you should also use minutes and seconds, it wil give you wrong output if you run the code at 10, 18 or 21 hrs
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
import time
currenttime = int(time.strftime("%H"))
print(currenttime)
if(currenttime>4 and currenttime =12 and currenttime=16 and currenttime
# 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
Bro shayad ek problem hai ismai agar hours=12 par tumhe vo good afternoon bhi wish karega
@@Anshpratap_editing sorry mene notice nhi kiya mene sahi kiya but edit krna bhul gya thanks batane ke liye
@@Rahuleditor80 good night
gg
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")
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
this is very late but you can also convert current hour to int then compare normally
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)
# 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")
do you live in delhi
Same aaj mera 5th day h lekin ye solve ho nhi ho raha
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😭😭😭😭
@@SaiGamer24 u can look for inbuilt modules in python {inbuilt modules are the ones present in python you can directly import them
@@SaiGamer24 practice se, jab sari class ho jayegi to mostly sb pata chal jayega jitni practice karoge utne achche hote jaoge
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
import time
timestamp=time.strftime('%H:%M')
print("The Time Currently is: ",timestamp)
a=int(time.strftime("%H"))
if(a
import time
timestamp = time.strftime('%H:%M:%S')
print(timestamp)
name = input("Enter your name: ")
hours = int(time.strftime('%H'))
if(0
@MuhammadRashid-be9xwo
Bhai, 11 and 12 ke beech me undefined hai. aur bhi thora modify karlo
@@vineetsinha4908 defined toh hai na? wo equal to operator bhi toh laga hai
@@alien6378 bro, to batao 11:30 me kya print hoga, kaha defined hai
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
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
He is explaining only to those who have already learnt it and are again revising
Bro i have no idea about strftime , it's new for me
a=int(input("enter a time"))
print("the time is:", a )
if(a9 and a=13 and a=17 and a
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
BUT MY TIME FORMAT IS 12 HOUR NOT 24 HOURS
@@notNEYMARjr. its ok no prblm dude !
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
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..
bro i am also new but i did it
@@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
@@youthoob3573 yup
# 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")
# 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
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.
can you pls write that program in comment section
@@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)
# 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
This is my code:-
a = int(input("Enter a time :-"))
if(a
use module bro
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")
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")
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")
# 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
thanks!
@@natureinsky2963 welcome my brother 🤗
But muje lag rha he ....sir ne itana padhaya hi nhi he .... like {} ye kese use kiya or kab karte he ?
@@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.
@@milestips thank you bhaiya 😊
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
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
nice
Best ever sir thank you so much sir 🙏❤️
Yesss 😁
import time
a = int(time.strftime("%H"))
if(a>=4 and a=12 and a=17 and a
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
Instead of h you have to use t2
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
This course is awesome 🔥🔥
import time
time = time.strftime('%H:%M:%S')
print(time)
if (time >= '00:00:00' and time = '12:00:00' and time
Bhai I have completed your previous 12 hr course of python but still I'm doing this series for my revision
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😭😭😭😭
tm = float(input("Current time is : "))
if ( tm = 12 and tm
user_time = int(input("Enter the time sir : "))
if user_time>6 and user_time12 and user_time17 and user_time21 and user_time
import time
now = str(time.ctime())
if(int(now[11:13])>0 and int(now[11:13])12 and int(now[11:13])
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")
solution:
import time
hour = int(time.strftime('%H'))
if hour < 12:
print('Good Morning Sir!')
else:
print('Good afternoon Sir!')
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 🧠😂
time = float(input("Enter the Time"))
if(time>0.00 and time12.00 and time17.00 and time
# 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
in last elif change am to pm...and in 2nd elif chnge pm itno am☺️
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
a = int(input("Enter the number when you woke up: "))
if(a>=5 and a10 and a
Harry Bhai please DSA IN JAVA ki playlist banado.
import time
x=time.strftime("%H:%M:%S")
print("Current Time is: ",x)
y=time.strftime("%H")
z=time.strftime("%M")
if (int(y)
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
its so much easier with 24 hour format
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
#a = input("Hello")
# timestamp = time.strftime('%H:%M:%S')
# print(timestamp)
# timestamp = time.strftime('%H')
# if(int(timestamp) >= 5 and int(timestamp)
what if time>24
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")
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
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
time = int(input("enter the time"))
if(time = 1):
print("good morning sir ", time)
elif(time>=13 and time =17 and time
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
a = int(input("Enter current time: "))
print("Your current time is", a)
if (a>=6 and a=12 and a=16 and a
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.
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")
Present bhaiya💜
time1 = int(input())
if time1
a = int(input('enter the value'))
if a>0 and a12 and a16 and a20 and a
import time
a=time.strftime("%T")
print(a)
if (a
I am not understanding anything why did u use time and what is it u didnt even explain it in prev videos😢😢😢😢😢
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
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")
import time
H = int(time.strftime("%H", time.localtime()))
if H>=12 and H=16 and H=20 and H=0 and H
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
bro where did you use the time module you just imported it
thank you you explained very well
thank you bhai you explain very well