logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    sfolax6776
    Nov 08, 2020

    What's this shape? How to make decisions?

    in Introduction to Python

    A. Introduction

    Declaring variables, taking input, calculating and printing out strings. We are familiar with this step by step sequential processing now. But what if you need to make decisions? For instance, based on a user's description, determine if a shape is a circle, a rectangle, a triangle, a parallelogram, or a trapezoid?

    B. Notes

    C. HW

    1. Given an integer, print "odd" if it's odd and print "even" otherwise.

    2. Given the two integers, print the least of them. Can you print the least of three numbers?

    3. For the given integer X print 1 if it's positive; -1 if it's negative. Can you print 0 if it's equal to zero?

    5 comments
    0
    albertwwyy
    Nov 08, 2020

    ermmm...

    0
    luphy.ma
    Nov 08, 2020

    #Given an integer, print "odd" if it's odd and print "even" otherwise. #Given the two integers, print the least of them. Can you print the least of three numbers? #For the given integer X print 1 if it's positive; -1 if it's negative. Can you print 0 if it's equal to zero? IntegerInput = 5 if (IntegerInput%2 == 1): print("Odd\n") if (IntegerInput % 2 == 0): print("Even\n") FInteger = 7 SInteger = 3 TInteger = 2 if (TInteger < SInteger < FInteger): print(TInteger) if (SInteger < TInteger < FInteger): print(SInteger) if (FInteger < TInteger < SInteger): print(FInteger) GInteger = 8 if (GInteger > 0): print("\n1") if (GInteger < 0): print("\n-1")

    kyleboss220
    Nov 08, 2020

    I dont understand do i need to use percents ?

    0
    luphy.ma
    Nov 08, 2020

    Percents just mean mod. You can use it to find out if a number is even or odd.

    Steven
    Dec 06, 2020

    a = int(input("Enter integer A: ")) if (a % 2 == 0): print("even") else: print("odd") b = int(input("Enter integer B: ")) c = int(input("Enter integer C: ")) if b > c: print (c) elif b < c: print (b) else: print("The two numbers are equal") d = int(input("Enter integer D: ")) e = int(input("Enter integer E: ")) f = int(input("Enter integer F: ")) if d < e and d < f: print (d) elif e < d and e < f: print (e) elif f < d and f < e: print (f) else: print("All three numbers are equal") x = int(input("Enter integer X: ")) if x > 0: print(1) elif x < 0: print(-1) else: print(0)

    0
    5 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners