Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

very noob question

ZeroOverRidZeroOverRid Posts: 23Member
hello I just started programming in python today and I am going to make a binary program for the heck of it. but so far I ran into a problem. for some reason it will not print 1. any help would be great thanks "
ps what is the difference from int(raw_input("ajajaj")) to input("aaaa")
I am not done with the program yet

name = raw_input("Please enter your name: ")
print "Hello", name, "Welcome to my Binary Program "
binary = int(raw_input("Please enter a number between 1-255: "))
if binary >= 255:
binary = binary - 128
print "1"

I figure it out but I have another question. here is the code I did to print 1 but I don't understand how it work? any help would be great

name = raw_input("Please enter your name: ")
print "Hello", name, "Welcome to my Binary Program "
binary = int(raw_input("Please enter a number between 1-255: "))
if binary >= 255: binary = binary - 128
print "1"

Comments

  • DarkAvengerDarkAvenger Posts: 1Member
    : hello I just started programming in python today and I am going to
    : make a binary program for the heck of it. but so far I ran into a
    : problem. for some reason it will not print 1. any help would be
    : great thanks "
    : ps what is the difference from int(raw_input("ajajaj")) to
    : input("aaaa")
    : I am not done with the program yet
    :
    : name = raw_input("Please enter your name: ")
    : print "Hello", name, "Welcome to my Binary Program "
    : binary = int(raw_input("Please enter a number between 1-255: "))
    : if binary >= 255:
    : binary = binary - 128
    : print "1"
    :
    : I figure it out but I have another question. here is the code I did
    : to print 1 but I don't understand how it work? any help would be
    : great
    :
    : name = raw_input("Please enter your name: ")
    : print "Hello", name, "Welcome to my Binary Program "
    : binary = int(raw_input("Please enter a number between 1-255: "))
    : if binary >= 255: binary = binary - 128
    : print "1"

    In first case you have a problem with indentation block. In second case you have if loop in one row, so there's no indentation needed. Seems that's all.
Sign In or Register to comment.