Python if...else Conditionals (for Decision Making) # 7

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

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

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

    🔥 Learn Python with a more hands-on experience with Programiz PRO-interactive lessons, quizzes & challenges.
    Try Programiz PRO: bit.ly/right-python

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

    Video has been so much more helpful than my professors MIS class. Thank you so much for the clear explanation!!

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

    Thanks for the lessons!!
    number = float(input('Your number',))
    if number > 0:
    print('the number positive')
    elif number < 0:
    print('the number is negative')
    else:
    print('the number is exactly 0')

  • @chipile
    @chipile 4 ปีที่แล้ว +24

    I just discovered this course and it is excellent! Everything is well explained for people like me, a complete beginner from Liberal Arts!

    • @screwdajuice
      @screwdajuice 3 ปีที่แล้ว

      ew

    • @sethbriar8221
      @sethbriar8221 3 ปีที่แล้ว

      i know im randomly asking but does anyone know of a way to log back into an Instagram account?
      I somehow lost the password. I would love any tricks you can give me.

    • @keagandylan5237
      @keagandylan5237 3 ปีที่แล้ว

      @Seth Briar instablaster :)

    • @sethbriar8221
      @sethbriar8221 3 ปีที่แล้ว

      @Keagan Dylan thanks for your reply. I got to the site on google and im trying it out atm.
      Takes quite some time so I will reply here later when my account password hopefully is recovered.

    • @sethbriar8221
      @sethbriar8221 3 ปีที่แล้ว

      @Keagan Dylan it worked and I now got access to my account again. Im so happy!
      Thanks so much, you really help me out!

  • @govardhanrt8352
    @govardhanrt8352 3 ปีที่แล้ว +5

    Thank u sir....one of the best tutorials I found in youtube.......ur teaching style really simple ..easy.... 🙏🙏🙏🙏🙏. Jai Puneeth bro

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

    Amazing explanation, easier can't be! I started Python to learn by my self almost 1 week ago (never before that did it). Such courses and short video are really good! Regards from Bulgaria!

  • @fatimam1120
    @fatimam1120 4 ปีที่แล้ว +14

    number = float(input("Enter a number: "))
    if number >0:
    print("The number is positive")
    elif number

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

    num = float(input('enter the number :'))
    if num == 0:
    print('the number is 0')
    elif num < 0:
    print('the number is negative')
    else:
    print('the number is positive')
    every one has the different approach
    happy coding !!!!!!

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

    Hi there, you are a very good teacher! I am just starting to learn coding and love your chanel, very easy to follow, and the examples helps us understand! Very good☆☆☆☆☆

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

    Number = int(input("Enter a number: "))
    if Number >= 1:
    print("the number is positive")
    if Number

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

    number = int(input("What is your number"))
    if number >= 1:
    print("Number is positive")

    if number == 0:
    print("Number is zero")

    elif number

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

    I just seen your Website for Data Structures.... It was awesome 🙂 !! Thanks

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

    when will you upload the c programming language tutorial
    and which is perfect book to learn c programming language for beginners
    and i appreciate the hard work of your team #programiz

  • @HariPrasad-mn5vu
    @HariPrasad-mn5vu 3 ปีที่แล้ว

    I gusse there is no other creator who can make this level of content that to for free BTW thanks for the online complier it helped me a lot

  • @DigitalAcademyOnline
    @DigitalAcademyOnline 3 ปีที่แล้ว

    Learning Python is something you would like to get in your skills, but you do not know where to start? This NEW channel will help you out leaning Python Programming from scratch - for complete Beginners, Intermediate and Advanced Levels

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

    This is the code i got omg it works
    values = int(input('Enter your number: '))
    if values > 0:
    print('The number is positive')
    elif values < 0:
    print('The number is negative')
    else:
    print('The number is 0')

  • @morin1997
    @morin1997 3 ปีที่แล้ว

    Very easy exercise!

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

    number = float(input("Enter Your Number: "))
    if number > 0:
    print("The number is postive")
    if number < 0:
    print("The number is negative")
    if number == 0:
    print("The number is 0")

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

      In second and third condition statement use elif instead of if

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

    for i in range(5):
    number=float(input("Enter the number:"))
    if number>0:
    print("The number is positive")
    elif number

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

    numder = int(input("Enter numder:"))
    if numder > 0:
    print("it a positive numder")
    elif numder < 0:
    print("it a negitave numder")
    else:
    print("it is zero")

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

    love the way to explain with examples❤❤

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

    this vid was more helpful than my whole ict class for the year , thx for this vid

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

    straight to the point and intuitive, very good.
    TY

  • @uday5300
    @uday5300 3 ปีที่แล้ว

    Punit 🙏 well explained bro.... Thanq programiz

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

    Thank you for helping me to get best marks for exams in python

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

    print ("Number analyzer")
    num = int(input("Enter your number "))
    if num > 0:
    print ("The number is positive")
    if num == 0:
    print ("okay its a zero number")
    if num < 0:
    print ("its negetive")

  • @deepanshuarora6963
    @deepanshuarora6963 3 ปีที่แล้ว

    Best video👍👍

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

    Great Tutorial for beginners, thanks

  • @puzzlesgame5718
    @puzzlesgame5718 3 ปีที่แล้ว

    Thanks sir . I learn from app . I doesn't understand than watch your videos. Thank you so much

  • @GovindSoniDotCom
    @GovindSoniDotCom 3 ปีที่แล้ว

    Hi , I love the content and your style of rotating the head left and right like Tanjavoor Doll..

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

    sir when you will be posting the string manipulation chapter of class 11?? Reply as soon as possible pls

  • @KiranPatil-jb2vi
    @KiranPatil-jb2vi 3 ปีที่แล้ว

    number=int(input("enter a number" or "variable"))
    if number>=1:
    print("This number is positive")
    elif number

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

    pls make sure you increase your audio volume

  • @aloksharma5468
    @aloksharma5468 3 ปีที่แล้ว

    Solid video. Thank you

  • @kushal-shaw-pvt
    @kushal-shaw-pvt 4 ปีที่แล้ว +1

    Thank you sir

  • @kelly7641
    @kelly7641 3 ปีที่แล้ว

    Good material. Easy to follow

  • @kushal-shaw-pvt
    @kushal-shaw-pvt 4 ปีที่แล้ว +1

    Please upload vedio regularly

  • @astroloxi8133
    @astroloxi8133 3 ปีที่แล้ว

    is endif and endwhile used in python or is that in pseudocode???????????????????????????????????????

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

    hello sir thank you for assisting us in this course how can i get your link in order to be linked with you on github

  • @shreemukkhi9311
    @shreemukkhi9311 4 ปีที่แล้ว

    Sir which app u r using to solve progarm

  • @sayandutta3205
    @sayandutta3205 4 ปีที่แล้ว

    number = float(input("enter number: "))
    if(number > 0 ):
    print("Positive")
    elif(number < 0):
    print("Negetive")
    else:
    print("it's zero")

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

    Hello, can you use more than one ELIF consecutive statements in a row?

  • @shivakumar.r245
    @shivakumar.r245 ปีที่แล้ว

    number= int(input("Enter the Number: "))
    if number > 0:
    print ("The Number is Positive")
    elif number< 0:
    print ("The Number is Negative")
    else:
    print("The Number is 0")

  • @rebecacrissti4995
    @rebecacrissti4995 3 ปีที่แล้ว

    Thank you 👍

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

    Thank you very much
    For this app ..

  • @bhavyachemitech4301
    @bhavyachemitech4301 4 ปีที่แล้ว

    great explanation

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

    number=float(input("enter a value:"))
    if number>0:
    print(" number is positive")
    elif number

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

    simply explained..

  • @neelamgupta1348
    @neelamgupta1348 3 ปีที่แล้ว

    Number = float(input("Enter a number: "))
    if Number

  • @elprofe7324
    @elprofe7324 4 ปีที่แล้ว

    Awesome content

  • @AbdulRahman-qv1kj
    @AbdulRahman-qv1kj 3 ปีที่แล้ว

    sign = float(input("enter the number you want to check:"))
    if sign == 0:
    print("your number is 0")
    elif sign >= 0:
    print("your number is positive")
    else:
    print("your number is negative")

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

    number=int(input("enter the number:"))
    if number0:
    print("positive number")
    else:
    print("it is zero")

  • @pandathegeneral2426
    @pandathegeneral2426 3 ปีที่แล้ว

    the answer to the programming task is this
    question = int(input("Enter a number: "))
    if question > 0:
    print ("The number is positive ")
    elif question == 0:
    print ("the number is 0")
    else:
    print ("The number is negative")

  • @brettbaumann8893
    @brettbaumann8893 4 ปีที่แล้ว

    tried it out myself really cool

  • @MDShahed-is2mt
    @MDShahed-is2mt ปีที่แล้ว

    # taking user input
    num = float(input("Enter a number: "))
    # checking if the number is positive or negative
    if num > 0:
    print("The number is positive.")
    elif num == 0:
    print("The number is zero.")
    else:
    print("The number is negative.")

  • @balachandrab5355
    @balachandrab5355 3 ปีที่แล้ว

    num= float(input())
    if num>0:
    print("The num is positive ")
    elif num

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

    Bro is there any PDF format for all python program it helps to study

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

    pov: not failing class thanks to this king

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

    Sir, you are the best

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

    nice . hey i need a favour from you to do. can you explain the types of control statements.

  • @BrokeCanadian
    @BrokeCanadian 4 ปีที่แล้ว

    This is awesome

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

    num=float(input("enter a number:"))
    if num0):
    print("the given number is positive ")
    else:
    print ("the given number is 0")
    OUTPUT
    -7
    The given number is negative
    3
    The given number is positive
    0
    The given number is 0

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

    Sir
    I have a doubt
    Can we give if statement like this?
    if(1,2):
    print("hai")
    If so, usually in condition we have to give relational expression or Boolean values?
    So, (1,2) means???

  • @AmitKumar-er6fz
    @AmitKumar-er6fz 3 ปีที่แล้ว

    i am using window 7 python 32 bit. this program not getting two print input,just replying syntex error

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

    num = float(input("Enter your score:"))
    if num >0:
    print("positive")
    elif num

  • @mdiftekhar6876
    @mdiftekhar6876 3 ปีที่แล้ว

    num = 0
    if num>0:
    print("the number is positive")
    elif num

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

    Thanks bro GBU

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

    I was toying around with a bit and wondered what would happen if I entered a float, something that some student might try. And it gave:
    Enter your score: 30.2
    Traceback (most recent call last):
    File "", line 1, in
    ValueError: invalid literal for int() with base 10: '30.2'
    But when I googled it, many answers said this is something Python could take care of automatically. Now I'm confused.

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

      Maybe your code was something like:
      score = int(input("Enter your score: "))
      Correct me if I am wrong.
      When you run the program and enter 30.2, the program tries to convert '30.2' string to integer, however, it's not possible.
      To fix this issue, consider changing your code to something like this:
      score = float(input("Enter your score: "))
      The float() function can convert '30.2' to a floating-point number.
      We have discussed about it in detail in this video th-cam.com/video/DRBybZ6hsY0/w-d-xo.html

    • @Trazynn
      @Trazynn 4 ปีที่แล้ว

      Yes that's correct, it was
      score = int(input("Enter your score: "))
      And
      score = float(input("Enter your score: "))
      Solves the issue. But is there truly no way to let python convert float into an integer?

    • @programizstudios
      @programizstudios  4 ปีที่แล้ว

      ​@@Trazynn You cannot convert '30.2' string into an integer directly. However, you can convert 30.2 number to an integer using the int() function. Something like this:
      score = float(input("Enter your score: "))
      score = int(score)
      print(score) # Output: 30
      One thing to notice here is that you will lose the part after the decimal point.

    • @Trazynn
      @Trazynn 4 ปีที่แล้ว

      @@programizstudios fantastic. That's what I was wondering.

    • @reygaji2573
      @reygaji2573 3 ปีที่แล้ว

      @@programizstudios so it means float is always better than int? Because float works on both integer and floating number.

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

    skipcount = -1
    song = ['always', 'look', 'on', 'the','bright','side','of', 'life']
    for sing in song:
    if sing == 'look' and skipcount 0: skipcount = skipcount - 1
    continue
    elif skipcount == 0:
    print ('a' + sing)
    skipcount = skipcount - 1
    else:
    print (sing)
    output:
    always
    look
    aside
    of
    life
    #My Ques: How does it count to 3 or 0 in order to print look and aside? from which direction?

  • @ABDOUROIHAMANESAID-jj6nk
    @ABDOUROIHAMANESAID-jj6nk 11 หลายเดือนก่อน

    number = float(input())
    if number > 0:
    print("The number is positive")
    if number < 0:
    print("The number is negative")
    if number == 0:
    print("The number is 0")

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

    sir plz create video on django

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

    hi sir , i have a query i put this type of code score = int (input("enter the score ="))
    if score > 100 and score < 0:
    print("Score is invalid.")
    but i don't get the output
    enter the score = -1
    -1
    >

  • @IcedVid
    @IcedVid 3 ปีที่แล้ว

    #This is a Program to find out if a number is Positive, Negative or 0
    number = int(input('Enter the number '))
    if number >=1:
    print (number,'is a Positive Number')
    elif number == 0:
    print ("The Number is 0")
    else:
    print (number,"Negative")

    • @10xcoding53
      @10xcoding53 3 ปีที่แล้ว

      in "if" you can not use double quotation(" ") ,you use single quotation(' ')

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

    Exercise Answer:
    numbers = float(input("Please Enter a Number: "))
    if numbers < 0:
    print(' The number is negative')
    elif numbers > 0:
    print(' The number is positive')
    else:
    print('This is number "0" ')

  • @Project.i
    @Project.i 9 หลายเดือนก่อน

    #using if and elif to print if the entered number is 0 or negative or positive
    number= float(input("Enter a Number: "))
    if number>0:
    print("The entered number is positive")
    elif number

  • @Legend-gu8uz
    @Legend-gu8uz 4 ปีที่แล้ว +3

    number = int(input("enter your number : "))
    if number > 0:
    print("Number is Positive")
    elif number < 0:
    print("Number is Negative")
    else:
    print("Number is 0")
    Project 3

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

    number = int(float(input("Give number less the 100.0 = ")))
    if number < 0:
    print("Negative")
    elif number > 0:
    print("Positive")
    else:
    print("Number is 0")

  • @jahnaviscraftworld
    @jahnaviscraftworld 3 ปีที่แล้ว

    what we should do if we have 3 conditions like the score should be = 50 ?

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

    Btw False, 0, empty string that is "" and I think None (not sure) is all considered False in if and elif statements, everything else is considered True. Even if you write:
    if "False":
    print("whatever")
    the print command will be executed because any string is always True, even if it says "False"

  • @SURAJKUMAR-dx1cc
    @SURAJKUMAR-dx1cc 3 ปีที่แล้ว

    If score program not running saying expect an indented block

  • @charlesyetman7733
    @charlesyetman7733 3 ปีที่แล้ว

    What if you wanted to include decimals?

  • @alislab1550
    @alislab1550 4 ปีที่แล้ว

    Please add some advanced programming videos containing image processing through python

    • @alislab1550
      @alislab1550 4 ปีที่แล้ว

      Please sir or share with me some link related to this!

  • @relaxingmoments-787
    @relaxingmoments-787 2 ปีที่แล้ว

    After watching all of your python videos, will I be a python expert??????

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

    num = int(input("Enter your number: "))
    if num >0:
    print("Your number is positive")
    elif num == 0:
    print("Your number is 0")
    if num

  • @harshad9203
    @harshad9203 3 ปีที่แล้ว

    uhh, hi i am s=also a beginer but i thought to make my own small project which is a password make i was trying to make but ur online compiler is working sloww, pls try to fix iit

  • @RandomFacts693
    @RandomFacts693 3 ปีที่แล้ว

    What is % and what is the role of it

    • @10xcoding53
      @10xcoding53 3 ปีที่แล้ว +1

      this use for remainder after division(modulo division),lick- (12%3)=0, (15%4)=3

    • @RandomFacts693
      @RandomFacts693 3 ปีที่แล้ว

      @@10xcoding53 thanks

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

    what is error in my programming??
    y=str(input("What is your name ?"))
    print("Nice to meet you", y)
    c=str(input("How are you ?"))
    if (c=="fine" or c=="very fine" or c=="good" or c=="very good" or c=="absolutely fine" or c=="absolutely good" or c=="well" or c=="better" or c=="nice" or c=="very nice"):
    print("nice to listen you", c)
    else:
    print("hope you will be fine later")
    x=int(input("What is your age"))
    if(x>=18):
    print("So You are an adult citizen")
    a=str(input("Do you have job??...answer in yes or no."))
    if(a=="yes"):
    print("Nice")
    else:
    print("you must find a way for source of money if needed")
    else:
    print("So you are a child")

  • @lastonline2614
    @lastonline2614 3 ปีที่แล้ว

    programming task
    .
    .
    .
    # Taking Input As Floating Point Number
    num = float(input("Enter A Number Of Your Choice: "))
    # Logical Tasks
    # If More Than Zero
    if num > 0:
    print("The Number Is positive")
    # If Less Than Zero
    elif num < 0:
    print("The Number Is Negative")

    # If The Number Is Zero Itself
    else:
    print("The Number Is Zero")

  • @surprichil
    @surprichil 4 ปีที่แล้ว

    Can I use If and elif without closing with else like exapmple below? please advise. Thanks.
    number = float(input("enter your number: "))
    if number < 0:
    print("The number is negative")
    elif number > 0:
    print("The number is positive")
    elif number == 0:
    print("The number is 0")

  • @_MAFIA_TEAM
    @_MAFIA_TEAM 4 ปีที่แล้ว

    Yes Sir

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

    number = float(input("Enter the number: "))
    if number == 0:
    print("The Number is 0")
    elif number > 0:
    print("The number is a POSITIVE")
    else:
    print("The number is a NEGATIVE")

  • @AmarNath-zz4lr
    @AmarNath-zz4lr 4 ปีที่แล้ว

    elf part of the video, in the exam, if score is changed to less than 100, it returns with an error while running
    score = 105

    if (score > 100 or score < o):
    print ("score is invalid")
    elif score >= 50:
    print("you have passed exam")
    else:
    print("Sorry you have failed :")

    • @cezartofan1791
      @cezartofan1791 3 ปีที่แล้ว

      but in the 3-rd line you used parentheses and i am not sure if this is correct

  • @pondugulasivareddy7978
    @pondugulasivareddy7978 3 ปีที่แล้ว

    number = int(input("Enter your number:"))
    number > 0
    print("The number is positive")
    number < 0
    print ("The number is negative")
    number == 0
    print("The number is 0")

  • @rikicade2012
    @rikicade2012 3 ปีที่แล้ว

    your solution

  • @arhamshahversatile
    @arhamshahversatile 4 ปีที่แล้ว

    *What's wrong with my code?*
    a = 1
    b = 5
    c = 8
    d = a + b
    e = a + c
    f = b + c
    if d > c :
    e > b
    f > a
    print('Approved')
    else:
    print("Not approved")
    *Please copy and try in your compiler*

    • @programizstudios
      @programizstudios  4 ปีที่แล้ว +3

      There are a couple of things:
      1) The condition of the if statement is (d > c). Other conditions e > b and f > a are not used (although it's not an error in Python).
      Maybe you wanted to do something like:
      if d > a and e > b and f > a:
      2) The indentation of print('Approved') is not correct. Try this:
      if d > c and c > b and f > a:
      print('Approved')
      else:
      print("Not approved")
      P.S. Try to give good variable names. I cannot understand what you are trying to do.

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

      Thank you very much!
      You made it work!

  • @jameshallares5666
    @jameshallares5666 4 ปีที่แล้ว

    score = int(input("enter your score:"))
    if score >= 50
    print("you have passed the exams")
    print("congratiolation")
    I copy the code and try to code it but the result is
    - File "", line 7
    if score >= 50
    ^
    SyntaxError: invalid syntax
    >
    what will I do sir?

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

      You missed the colon after if score >= 50

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

      @@programizstudios thanks sir your great teacher. I like your video,

  • @thomasilerioluwa7991
    @thomasilerioluwa7991 3 ปีที่แล้ว

    Thanks for impacting in millions of souls just like me.
    My question is if user accidentally input alphabet known as string into a given user input and it crased the code by return an error message 👇👇👇👇
    Number = float(input("Enter a number" :)
    if number > 0:
    print ("The number you entered is a positive number")
    elif number == 0:
    print ("The number you entered Zero")
    esle:
    print ("The number you entered is a negative number")
    What if use enter "A" for instance and an error message waa returned so how can I write a code to tell users that only digit/number can be accepted as input.

  • @jollyrider2154
    @jollyrider2154 3 ปีที่แล้ว

    You should create a course on udemy

  • @praveenbanoth6826
    @praveenbanoth6826 3 ปีที่แล้ว

    #how we can ignore zero values. for example if ans is 1day...i have to print(1 day). but i got ans is("1 days 0 hours 0 min 0 sec) please explain this.
    time =int(input())
    day = time // (24 * 3600)
    time = time % (24 * 3600)
    hour = time // 3600
    time %= 3600
    minutes = time // 60
    time %= 60
    seconds = time
    if day > 0:
    print((str(int(day)) + " Days")+(" ") + (str(int(hour)) + " Hours") +(" ") + (str(int(minutes)) + " Minutes") + (" ")+ (str(int(seconds)) + " Seconds"))
    elif hour > 0:
    print((str(int(hour)) + " Hours") +(" ") + (str(int(minutes)) + " Minutes") + (" ")+ (str(int(seconds)) + " Seconds"))
    elif minutes > 0:
    print((str(int(minutes)) + " Minutes") + (" ")+ (str(int(seconds)) + " Seconds"))
    else:
    print(str(int(seconds)) + " Seconds")

  • @mr.k8660
    @mr.k8660 3 ปีที่แล้ว

    balance = 3000
    print("Welcome to the bank !")
    print("press A to make a deposit or B to make a withdrawal")
    Q = (input("What dou you want to do ? :"))
    if Q == A :
    Q2 = input(input("how much do you want to deposit ? :"))
    if Q2 >0:
    print("your balance is now :",balance-Q2)
    th compiler says that A is not defined