This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
new_list = [] | |
for x in a: | |
if x < 5: | |
new_list.append (x) | |
else: | |
print (new_list) | |
break | |
# Extras |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print ('This is an exercise to check the number is even or odd') | |
print () | |
number = int (input ('Please enter a number: ')) | |
print() | |
if number % 2 == 0 : | |
print ('This is an even number') | |
else: | |
print ('This is an odd number') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = input ('Enter your name: ') | |
age = int (input ('Enter your age: ')) | |
print ('Welcome ', name) | |
print ('You will be 100 years old on ', 100 - age + 2020) |