Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Python Chapter Exam Programs

M=input("How many liters would you like to convert to Gallons, Quarts, Pints, and
Cups?")
L=M/3.79
G=L%1
a = (L-G)
Q=a%0.25
b = (G-Q)
P=b%0.125
c = (Q-P)
C=c%0.0625
d = (P-C)
O=d%0.0078125
e = (C-O)
print a
print b
print c
print d
print e

#G=M/3.79
#Q=G/4
#P=Q/2
#C=P/2
#O=C/8
#1P=1.39D
#1P=1.27E

#1E=1.10D
#1E=0.79P

#1D=0.91E
#1D=0.72P

x=input("What currancy do you currently have? If Dollars input 1, if Euros input 2, if


Pounds input 3.")
m=input("How much of that currancy do you have?")
if x==1:
E=m*0.91
P=m*0.72
print "The amount of Euros you will have is",E
print "The amount of Pounds you will have is",P
elif x==2:
D=m*1.10
P=m*0.79
print "The amount of Dollars you will have is",D
print "The amount of Pounds you will have is",P
elif x==3:
D=m*1.39
E=m*1.27
print "The amount of Dollars you will have is",D
print "The amount of Euros you will have is",E
s=raw_input("Enter some numbers, enter a zero to terminate: ")
list=[]
x=s.split()
for e in x:
n=float(e)
k=n%2
if k==0:
list.append(n)
print "The numbers that are even are",list
list=[]
x=s.split()
for e in x:
n=float(e)
k=n%2
if k>=1:
list.append(n)
print "The numbers that are odd are",list

You might also like