**RESOURCES: **

Class slides: __https://docs.google.com/presentation/d/1kY_YhPN9f8OI-mVB-gzk6ukoakYycvhzds_2g96ofIk/edit?usp=sharing__

Code from class: __https://replit.com/@ShravyaS/IntroToPython-Wk1Day2__

Coding platform: __replit.com__

**HOMEWORK:**

Write a program that takes two inputs and stores them in variables feet and inches. Print output of their height in only inches. (12 inches = 1 foot)

Using the six comparison operators and three logical operators, write two expressions that are true and two expressions that are false.

*Post your answers as a comment! *Solutions will be posted later (we'll also go over it next class).

Feel free to email __shravyassathish@gmail.com__ (mentor) or __kingericwu@gmail.com__ (TA) if you're stuck or have questions! See you :)

#1

feet = input("Please enter the length: ")

inches = input("Please enter the number of inches: ")

total = 12*int(feet) + int(inches)

print("The total number of inches is " + str(total))

#2

True: 10 > 8 L < o

False: 2 == 18 5 >= 4

ft=input("enter the length of a book.")

in.=input("enter the number of inches. ")

total=12*int(ft)+int(in.)

print (The length of this book is"+str(total))

feet = input("enter the number of feet: ")

inches = input("now enter the number of inches: ")

total = 12*int(feet) + int(inches)

print("the total amount in inches is "+str(total))

True:

2>1 or 5>2

4 >= 3 and 5<7

False:

1>3 or 4 <=3

5 == 2 and 3 >= 2

print("Find your height in inches.")

ft = input("Write you height in feet: ")

inch = input ("Write your inches height: ")

ft = int(ft)

ft = 12*ft

inch = int(inch)

height = ft+inch

print(f'You are {height} inches tall!')

#True

print(4>=3 and 5!=6)

print(5==2 or 4<=6)

#False

print(not 6>5)

print(2<3 and 7!=7)

feet = input("How many feet is this")

inches = int(feet)*12

print(f'It is {feet} feet or {inches} inches.')

feet = input("How many feet is this")

inches = int(feet)*12

print(f'It is {feet} feet or {inches} inches.')

Hi everyone, sorry I wasn't there for the 2 classes, I was out in Florida. I'll be posting homework solutions here. If you need other examples you can also look at solutions from other students.

Part 1

inches = int(input())

feet = int(input())

print(inches+(12*feet))

Part 2

5<6 (true)

8!=7 (true)

5<5 (false)

3==4 (false)

#Homework Wee2 : Problem 1

print("What is your height?")

feet = input("Feet= ")

inch= input("Inch= ")

height=int(feet)*12+int(inch)

print("Your height = "+str(height)+" inches")

#Homework Week2 : problem 2

#True

print( 5==5 or 9>=10 )

print( not(3==4))

#False

print(8<=-1 or not(1.5>=0.9))

print( "Apple"=="apple" and ("ICE"=="ICE"))

print("Hello would you like to see your height in inches?")

feet=input("Put your feet: ")

inches=input("Put your inches: ")

feet=int(feet)

inches=int(inches)

height=inches+feet*12

print("Your height in inches is " + str(height)) #True

print (5!=6 and 5>3)

print (5>=5 or 6==9)

#False

print (4==1 and 4==4)

print (7>=9 or 3>7)

#feet to inches

inches = input("feet: ")

feet = int(inches) * 12

#inches to feet

feet1 = input("inches: ")

inches = int(feet1) // 12

#Expressions

#True

4>3 or 3<4

3>=3 and 3>2

#False

4<3 or 3>4

3>3 and 3<2

def inchheight(f,i):

inch = f * 12 + i

return(inch)

def realheight(i):

foot = i // 12

inch = i % 12

if foot == 1:

j = foot, "foot"

else:

j = foot, "feet"

if inch == 1:

k = inch, "inch"

else:

k = inch, "inches"

return j,k

True

4 > 3 OR 5 == 7

NOT 4 < 9

False

3 <= 3 AND 8 != 8

NOT 5 >= 3

This looks too confusing

Program:

start=input("Hello, Homo sapien. Do you want to input a height in feet and inches? This program will output the height in only inches. (yes/no): ")

if start=="yes":

feet=input("Input the Feet: ")

inches=input("Input the Inches: ")

feet=int(feet)

inches=int(inches)

height=feet*12+inches

print("The Height in Inches:", height,"\n Goodbye.")

elif start=="no":

print("Goodbye.")

else:

print("I don't understand. Goodbye.")

Four Expressions:

a. True expressions:

1. 3.0>=1 and 4!=1

2. True or 5==9

b. False expressions:

1. not (2<6 and 5!=3)

2. 5>=8 or 9<=7