コード例 #1
0
from ess import ask

number = ask("Enter a number less than 10.")

while number >= 10:
    print("Try again.")
    number = ask("Enter a number less than 10.")
print("You found a number less than 10. Thanks for using the program!")
コード例 #2
0
# Volume of a Cube, Nathan Hernandez
from ess import ask

volOne = ask("What is your first number?")  #  Original Number used: 15
volTwo = ask("What is your second number?")  # Original Number used: 15
volThree = ask("What is your third number?")  # Original Number used: 15

volumesTogether = volOne * volTwo * volThree
print('Your volume is', volumesTogether)
コード例 #3
0
from ess import ask

number = ask("Enter a number.")
total = number

while total < 20:
    print("Enter another number.")
    number = ask("Enter a number.")
    total = total + number
print("Congrats! You got over 20!")
コード例 #4
0
from ess import ask 

print("Enter two numbers that equal 10")
num1 = ask("First number?")
num2 = ask("Second number?")

while num1 + num2 != 10:
  print("Try again")
  num1 = ask("First number?")
  num2 = ask("Second number?")
  
print("Good job!")
コード例 #5
0
# Perimeter of a Triangle, Nathan Hernandez
from ess import ask

a = ask("What is your first number?")
b = ask("What is your second number?")
c = ask("What is your third number?")

p = a + b + c
print('The perimeter of your triangle is', p)
コード例 #6
0
# Program 2
# Code: Nathan Hernandez
from ess import ask 

number = ask("Enter a number between 10 and 20.")

if number < 10:
    print("This number is lower than 10. Please pick a higher number.")

if number > 20:
    print("This number is higher than the requested limit. Please pick a number between 10 and 20.")

if number >= 10 and number <= 20:
    print("Congratulations! You picked a number between 10 and 20. Awesome!")
コード例 #7
0
    print(sideAnswer)


def perimeterOfATriangle(side1, side2, side3):
    sidesTogether = side1 + side2 + side3
    print(sidesTogether)


# Don't edit anything below here. It will print a menu to allow
# the user to select which of your functions is run.
print("What do you want to calculate? ")
print("[1] The area of some circles")
print("[2] The volume of some cubes")
print("[3] The perimeter of some triangles")
print("")
choice = ask("Enter your selection: ")

if choice == 1:
    areaOfACircle(5)
    areaOfACircle(10)
    areaOfACircle(20)

if choice == 2:
    volumeOfACube(2)
    volumeOfACube(8)
    volumeOfACube(15)

if choice == 3:
    perimeterOfATriangle(2, 3, 4)
    perimeterOfATriangle(7, 8, 10)
    perimeterOfATriangle(25, 38, 43)
コード例 #8
0
from ess import ask

print("FIRST LOOP")
for i in range(5):
    print("Hello")

print("")
print("SECOND LOOP")
for j in range(3):
    print("j =", j)

print("")
print("THIRD LOOP")
for i in range(6, 10):
    print("i =", i)

print("")
print("ADDER")
total = 1
for i in range(4):
    num = ask("Enter a number:")
    total * num
print("The numbers add to", total)

word = ask("Enter a random word.")
number = ask("Enter a number. This will be used later in the program.")

for i in range(number):
    print(word)
print("Your word has been successfully printed", number, "times.")
コード例 #9
0
from ess import ask

number = ask("Guess a number between 1 and 20.")

while number != 12:
    if number > 12:
        print("Number is too high to be the answer.")
    if number < 12:
        print("Number is way too low to be the answer.")
    print('Wrong number. Try again.')
    number = ask("Guess a number between 1 and 20.")
print("Great job, you got 12.")
コード例 #10
0
# Program One - Write a number that asks the user to enter a number between 1 and 5. The program should output the number in words.
# Code: Nathan Hernandez

from ess import ask

number = ask("Choose a number between 1 and 5.")

if number == 1:
    print("One.")

if number == 2:
    print("Two.")

if number == 3:
    print("Three.")

if number == 4:
    print("Four.")

if number == 5:
    print("Five.")
コード例 #11
0
# Program 3
# Code: Nathan Hernandez

from ess import ask

number = ask("Choose a number.")
numberTwo = ask("Choose a second number.")
numberThree = ask("Choose a third number.")

if number > numberTwo and numberThree:
    print(number, "is higher than", numberTwo, "and", numberThree)

if numberTwo > number and numberThree:
    print(numberTwo, "is higher than", number, "and", numberThree)

if numberThree > numberTwo and number:
    print(numberThree, "is higher than", numberTwo, "and", number)
コード例 #12
0
# Area of a Square, Nathan Hernandez
from ess import ask 

a = ask("What's your first number?")
b = ask("What's your second number?")

v = a * b
print("The area of your square is",v)