W2Q1Ans

Published on
Scene 1 (0s)

Users > macbook > Desktop > W2Q1.py > 1 2 3 4 5 6 7 x= int(input("enter fahrenheit if x 32 and x 212: print("it is liquid") if x > 212: print("it is gas") if 32: print("it is solid." ) tempa rature:")) TERMINAL please enter temparature in fahrenheit here using if statement for liquid state if if if if if statement is true. it prints liquid state statement for checking x is more than 212 or not its true it prints it is gas state statement for checking x is less than 32 or not its true it prints it is solid state PROBLEMS OUTPUT DEBUG CONSOLE /usr/local/bin/python3 /Users/macbook/Desktop/W2Q1. py macbook@1acBook—Pro—di—macbook % /usr/local/bin/python3 /Users/macbook/Desktop/W2Q1.py enter fahrenheit temparature:22 it is solid..

Scene 2 (30s)

Users > macbook > Desktop > W2Q2.py > e løø 1 2 3 4 5 6 7 8 9 lø a int(input("Enter the day :")) b = int(input("Enter the month C = int(input("Enter in the year ) ) if d f' print(a, else: print(a, Asking user to Enter the day Asking user to Enter the month Asking user to Enter the year mathematical operation for a and b inputs let take e as input for mathematical calculation mathematical calculation for finding reminder if statement for checking magic number if statement is true it prints its magic date else statement for not equal # prints its not magic date PROBLEMS OUTPUT f, "Hey, its a magic date") f, "Sorry, its not magic date") DEBUG CONSOLE TERMINAL /us r/ local/bin/python3 /Users/macb00k/Desktop/W2Q2. py macbook@1acBook—Pro—di—macbook % /usr/local/bin/python3 /Users/macbook/Desktop/W2Q2.py Enter the day : 10 Enter the month :2 Enter in the year : 2Ø 10 2 20 Hey,its a magic date.

Scene 3 (1m 6s)

Users > macbook > Desktop > W2Q3.py > (e] x print ("pocket 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 roulette pocket number print("pocket color os green") f rom f rom ø to 36 . asking if if if for roulette pocket number statement statement statement if if if if if and print ("pocket print ("pocket and print ("pocket print ("pocket and print ( "pocket print ("pocket and color color color color color color color color is is is is is is is black") red") red") black") black") red") red" ) black") mathematical if statement mathematical if statement if statement mathematical if statement mathematical if statement if statement mathematical if statement mathematical if statement if statement mathematical if statement mathematical if statement if statement if statement for checking pocket number is true is prints green for checking pocket number 1 to 10 operation for checking even numbers is true is prints black operation for checking odd numbers is true is prints red for checking pocket number 11 to 18 operation for checking even numbers is true is prints red operation for checking odd numbers is true is prints black for checking pocket number 19 to 28 operation for checking even numbers is true is prints black operation for checking odd numbers is true is prints red for checking pocket number 29 to 36 operation for checking even numbers is true is prints red operation for checking odd numbers is true is prints black for user enter out of range pocket numbers is true. the user enter out of range pocket numbers. print( "pocket X>36 or X<ø: print ("Its Error. OUTPUT please enter numbers to 36") it prints Error. PROBLEMS DEBUG CONSOLE TERMINAL /usr/IocaI/bin/python3 /Users/macb00k/Desktop/W2Q3. py macbook@acBook—Pro—di—macbook % /usr/loca1/bin/python3 Enter roulette pocket number from to 36 : 25 pocket color is red /Users/macbook/Desktop/W2Q3. py.