this is the simple program take the inputs from the user and process the output using the if elif and else
x = int(raw_input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
x = 0
print 'Negative changed to zero'
elif x == 0:
print 'Zero'
elif x == 1:
print 'Single'
else:
print 'More'
More
//to write in file
//for raspberry pi
sudo nano filename.py
//for beagle bone black
nano filename.py
//for compiling the code
//on raspberry pi
sudo python filename.py
//on beagle
python filename.py
x = int(raw_input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
x = 0
print 'Negative changed to zero'
elif x == 0:
print 'Zero'
elif x == 1:
print 'Single'
else:
print 'More'
More
//to write in file
//for raspberry pi
sudo nano filename.py
//for beagle bone black
nano filename.py
//for compiling the code
//on raspberry pi
sudo python filename.py
//on beagle
python filename.py
No comments:
Post a Comment