0% found this document useful (0 votes)
125 views3 pages

Python Chapter Exam Programs

The document contains Python programs for converting between liquid and volume units, currency conversions, and determining even and odd numbers from a list of user-input numbers. The programs take user input to convert liters to gallons, quarts, pints and cups or to determine the amount of different currencies based on an original currency and amount. A third program separates numbers input by the user into even and odd numbers and prints the results.

Uploaded by

api-359784889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views3 pages

Python Chapter Exam Programs

The document contains Python programs for converting between liquid and volume units, currency conversions, and determining even and odd numbers from a list of user-input numbers. The programs take user input to convert liters to gallons, quarts, pints and cups or to determine the amount of different currencies based on an original currency and amount. A third program separates numbers input by the user into even and odd numbers and prints the results.

Uploaded by

api-359784889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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