Exercise 2: Solution & Shoutouts | Python Tutorial - Day #26

preview_player
Показать описание
Python is one of the most demanded programming languages in the job market. Surprisingly, it is equally easy to learn and master Python. This python tutorial for absolute beginners in Hindi series will focus on teaching you python concepts from the ground up.

python, C, C++, Java, JavaScript and Other Cheetsheets [++]:

►Learn in One Video[++]:

►Complete course [playlist]:

Follow Me On Social Media
Comment "#HarryBhai" if you read this 😉😉
Рекомендации по теме
Комментарии
Автор

t=int(input ("Enter time"))
h=int(input ("Enter hours"))

if(t>12 and t<16):
print("Good Afternoon")
elif(t>16 and t<20):
print("Good Evening")
elif(t>20 and t<24):
print("Good Night")
elif(t>=0 and t<12):
print("Good morning")
else:
print("Invalid time entered")

sonalnivsarkar
Автор

Day6 of #100DaysOfCode. Today in this video 26, I learned how to create a Python program that greets me with "Good Morning, " "Good Afternoon, " or "Good Evening" based on the current hour. I used the time module and its strftime() function to obtain the current time in hours, minutes, and seconds. This exercise taught me the importance of tailoring program outputs to real-world conditions, and I gained valuable experience in using Python's built-in modules to access and manipulate time data.
Thank You Harry Bhaiya.

debasishbesra
Автор

# hey harrybhaiya if you read this I basically use pydriod3 in mobile
And here is my code :-
import time
timestamp =int(time.strftime('%H'))
minutes = int(time.strftime('%M'))
seconds = int(time.strftime('%S'))
print('Hours', '=', timestamp)
print('Minutes', '=', minutes)
print('Seconds', '=', seconds)
if timestamp < 12 :
print("Good Morning Sir")
elif 12 >= timestamp < 17:
print ("Good Afternoon Sir")
elif 19 > timestamp >= 17:
print("Good Evining Sir")
elif timestamp >= 19 :
print ("Good Night Sir")

unknownbhai
Автор

time=int(input("enter the time: "))
if (time>5 and time<=12):
print("good morning sir")
elif(time>=12 and time<=16):
print("good afternoon sir")
elif(time>=16 and time<=21):
print("good evening sir")
else:
print("good night sir")

o/p:enter the time: 7
good morning sir

V_Wankhede
Автор

Nice video sir actully did this in Arduino C++ using RTC (Real Time clock DS3231 module) also ble ot set alarm on it and shows AM and PM using same method.

mtalhakhalid
Автор

Imagine getting ultimate course Web development 2023🤛🏻❤️

MahadKhan
Автор

My Target : to complete this course in 15 days, started from 5th June. Thanks Harry Boss.

shaktii
Автор

Present sir 😁
After a trip of 1 week I got 7 backlogs in this program....
Backlog 2/7 completed

abhinav
Автор

Good Evening Sir,

def SayMorning(time):
hour = int(time.split(":")[0])
if hour <= 12:
return "Good morning sir"
elif hour >= 13 and hour <= 17 :
return "Good afternoon sir"
elif hour > 16 and hour <= 21:
return "Good evening sir"
else:
return "Good night sir"

import time
ctime = time.ctime().split(" ")[3]
say= SayMorning(ctime)
print(say)

try_gettechnical
Автор

@CodeWithHarry In the last elif condition it should be hours>=17 only. Otherwise the condition will be false

shakeeb
Автор

4:27 here is the small mistake in the code: (line 11) a number can not be greater than 17 and less than 0 at the same time! It should be greater than 17 and less than 24

lokeshlanjewar
Автор

import time
t=time.strftime("%H:%M:%S")
hour = int(time.strftime( '%H'))
hour = int(input("Enter hour: "))
print(hour)
if(hour>=00 and hour<12):
print( "Good Morning Sir!")
elif(hour>=12 and hour<17):
print("Good Afternoon Sir!")
elif(hour>=17 and hour<24):
print( "Good Night Sir!")

deathrouteff
Автор

Bhaiya maine STRFTIME wala method use nhi kiya
maine direct user se inpur manga "Enter any number from 0 to 24"
& uske hisaab se if else statement use karke greet kiya

trivendramathur
Автор

Pranam bhrata 🙏 apka bahutt baht dhanyawad 😄🧡😇🙏

anonymous____________________
Автор

this video is like buying 1% equity of a future giant company with giving few times only, and see it's free! thanks man, take tons of love <3

abrarulhasan
Автор

It can be also done by datetime module more perfectly

kasturimitra
Автор

Hi sir, i am from India, i Think you code some smalll issue, time is 24 hour not 0 hour
. this is the my correct code
import time

timerstamp = time.strftime("%H : %M : %S")
print(timerstamp)
# you Choose Your Current Time
hour = int(time.strftime("%M"))
print(hour)
# user Choose Correct Time
hour = int(input("Enter Your TImeZone: "))

if(hour>0 and hour<12):
print("Good Morning")
elif(hour>=12 and hour<16):
print("Good Afternoon")
elif(hour>=16 and hour<24):
print("Good Night")
else:
print("Enter Your Correct Time")

Thank You!!

AbhishekKumar-iwq
Автор

import time
hour = int(time.strftime("%H"))
print("Good Morning") if hour<12 else print("Good Afternoon") if hour<16 else print("Good Evening")

SoumenMaity
Автор

paaji you confused a lot but my answer was right, Now you re increasing my confidence level, PAAJI TUSI GRAT HO TOFA KUBOOL THING YOU WILL MAKE ME AN ABOSOLUTE PROGRAMER MYSELF (A BIG ZERO) TO hero(Hopefully)
🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰🥰

t-rex
Автор

import time


hr = time.localtime().tm_hour

if 6 <= hr < 12:
print("Good Morning, sir")
elif 12 <= hr < 18:
print("Good Afternoon, sir")
elif 18 <= hr < 21:
print("Good Evening, sir")
elif 21 <= hr < 6:
print("Good Night, sir")

aadarshchaudhary
visit shbcf.ru