Cse039 Lab 2B
Cse039 Lab 2B
words=sentence.split()
print(words)
sentence = "apple,banana,orange"
fruits = sentence.split(",")
print(fruits)
x, y = input().split()
x = float(x)
print(x)
1 2
1.0
x = "123"
ix = int(x)
print(ix)
123
QUESTION 1
QUESTION 2
QUESTION 3(B)
QUESTION 4
QUESTION 6
base_cost=0
additional_charge=0
weight=int(input("enter the weight of the package(in pounds):"))
distance=int(input("enter the distance it needs to be shipped(in
miles):"))
if weight<=2:
base_cost=5
elif weight>2 and weight<=10:
base_cost=10
else:
base_cost=20
if distance<=100:
additional_charge=0
elif distance>100 and distance<=500:
additional_charge=5
else:
additional_charge=10
print("TOTAL AMOUNT")
total=base_cost+additional_charge
print("$",total)
TOTAL AMOUNT
$ 25
YES
enter the amount to be paid for renting the cooler per month: 5
enter the amount to be paid for purchasing a cooler: 10
enter the months the summer will be lasting: 2
NO
enter the amount to be paid for renting the cooler per month: 5
enter the amount to be paid for purchasing a cooler: 10
enter the months the summer will be lasting: 3
NO
PROBLEM SOLVING 2