calculator.ipynb
In [ ]:
Copied!
first_number = int(input("Enter the first number "))
second_number = int(input("Enter the second number "))
first_number = int(input("Enter the first number "))
second_number = int(input("Enter the second number "))
Enter the first number 5 Enter the second number 4
In [ ]:
Copied!
print(f"The first number is {first_number}")
print(f"The second number is {second_number}")
print(f"The first number is {first_number}")
print(f"The second number is {second_number}")
The first number is 5 The second number is 4
In [ ]:
Copied!
# Add the first and second numbers and print the result
sum = first_number + second_number
print(f"the sum is {sum}")
# Add the first and second numbers and print the result
sum = first_number + second_number
print(f"the sum is {sum}")
the sum is 9
In [ ]:
Copied!
street = int(input("What street are you on?"))
if street > 200:
print("You're in the Bronx")
elif street >= 116 and street <= 120:
print("You're at Columbia")
elif street > 56:
print("You're uptown")
elif street > 14:
print("You're midtown")
else:
print("You're downtime")
street = int(input("What street are you on?"))
if street > 200:
print("You're in the Bronx")
elif street >= 116 and street <= 120:
print("You're at Columbia")
elif street > 56:
print("You're uptown")
elif street > 14:
print("You're midtown")
else:
print("You're downtime")
What street are you on?118 You're at Columbia
In [34]:
Copied!
number = 1
while number < 10:
print(number)
number += 1
number = 1
while number < 10:
print(number)
number += 1
1 2 3 4 5 6 7 8 9
In [36]:
Copied!
list(range(5))
list(range(5))
Out[36]:
[0, 1, 2, 3, 4]
In [38]:
Copied!
how_many_siblings = int(input("how many siblings do you have?"))
for i in range(how_many_siblings):
name = input(f"What is sibling {i}'s name?")
print(f"Hello {name}")
how_many_siblings = int(input("how many siblings do you have?"))
for i in range(how_many_siblings):
name = input(f"What is sibling {i}'s name?")
print(f"Hello {name}")
how many siblings do you have?2 What is sibling 0's name?Leah Hello Leah What is sibling 1's name?Bob Hello Bob
In [38]:
Copied!