コード例 #1
0
def infinite_loop():

    while True:

        n = input("Enter a value: ")
        int_n = int(n)
        print(utils.process_item(int_n))
コード例 #2
0
def main():
    while (1):
        x = input("Enter number: ")
        if x == "q":
            return
        try:
            x = int(x)
        except:
            print("Wrong Input")
        else:
            print(utils.process_item(x))
コード例 #3
0
ファイル: app.py プロジェクト: Serithipithy/FII
def function():
    x = 0
    y = 0
    while 1:
        inputs = input()
        if (inputs == "q"):
            return "Program ended."
        else:
            x = int(inputs)
            y = utils.process_item(x)
            print(y)
コード例 #4
0
ファイル: prehab.py プロジェクト: findgriffin/pointy
def process_loc(text, db, date, name):
    messages = ['%s: ' % name]
    for part in text.split(','):
        try:
            name, points, msg = utils.process_item(part, db['prehab']) 
        except ValueError as err:
            messages[-1] += err.message

        else:
            if not date in db['days']:
                db['days'][date] = []
            db['days'][date].append((name, points))
            messages.append(msg)
    return messages
コード例 #5
0
def process_meal(text, db, date, name):
    messages = ['%s: ' % name]
    for part in text.split(','):
        try:
            name, points, msg = utils.process_item(part, db['foods']) 
        except ValueError as err:
            messages[-1] += err.message

        else:
            if not date in db['days']:
                db['days'][date] = []
            db['days'][date].append((name, points))
            messages.append(msg)
    return messages
コード例 #6
0
from utils import process_item

while 1:
    x = input("Number: ")
    if x == 'q':
        break
    x = int(x)
    print('Least prime number greater than %d is %d.' % (x, process_item(x)))
コード例 #7
0
ファイル: app.py プロジェクト: FilosGabriel/school-stuff
import utils

if __name__ == "__main__":
    while True:
        x = input("Number: ")
        if x == 'q':
            break
        print(utils.process_item(int(x)))
    else:
        print("Exit")
コード例 #8
0
import utils

while True:
    choice = input("Enter your number: ")
    if choice == 'q':
        break
    else:
        print(utils.process_item(int(choice)))
    
コード例 #9
0
ファイル: app.py プロジェクト: alexbarsan944/Python
# b) Write a module named app.py. When this module is run, it will run in an infinite loop, waiting for inputs from
# the user. The program will convert the input to a number and process it using the function process_item implemented
# in utils.py. You will have to import this function in your module. The program stops when the user enters the
# message "q"

import utils as ut

while True:
    x = input("Input variable:")
    if x == 'q':
        print("Exiting ... ")
        break
    print(ut.process_item(int(x)))
コード例 #10
0
ファイル: exercise1.py プロジェクト: adechan/School
import utils

number = input()
print(utils.process_item(number))
コード例 #11
0
#1)
#app.py

from utils import process_item

runnning = True
while runnning:
    nr = input("Number:")
    if nr == "q":
        runnning = False
    else:
        print(process_item(int(nr)))


###utils.py

def process_item(x):
    found = 0
    while found == 0:
        x += 1
        prim = True
        for div in range(2, int(x / 2)):
            if x % div == 0:
                prim = False

        if prim == True:
            found = 1

    return x

コード例 #12
0
import utils
import app

# Ex1.1 
n = input("Enter a value: " )
print("Next prime number is: ", utils.process_item(n))

# Ex1.2
# app.infinite_loop()

# Ex2
def sum(*x):
    sum = 0
    for i in x:
        sum += i
    return sum


def functionArgs(* args):
    sum = 0
    for i in args:
        sum += i
    return sum

print("Sum is:", functionArgs(1, 2, 3))

def anonymousArgs():
    return lambda *args: sum(*args)

print("Sum is:", anonymousArgs()(1, 2, 3))
コード例 #13
0
ファイル: app.py プロジェクト: limelier/py-labs
import utils

if __name__ == '__main__':
    while True:
        inp = input('Input a number, or q to quit: ')
        if inp == 'q':
            break
        elif inp.isnumeric():
            num = int(inp)
            print('Next prime is', utils.process_item(num))
        else:
            print("I don't understand.")
r
コード例 #14
0
__doc__ = """
1)
b) Write a module named app.py. When this module is run, it will run in an infinite loop, 
waiting for inputs from the user. 
The program will convert the input to a number and process it using the function process_item implented in utils.py.
You will have to import this function in your module. The program stops when the user enters the message "q".
"""

from utils import process_item

if __name__ == "__main__":
    print("Enter some integers. Press q to stop!")
    x = input()
    while x != "q":
        try:
            x = int(x)
            print(process_item(x))
        except Exception as e:
            print(e)
        x = input()
コード例 #15
0
ファイル: app.py プロジェクト: adechan/School
# it will run in an infinite loop, waiting for inputs
# from the user. The program will convert the input to a
# number and process it using the function process_item
# implented in utils.py. You will have to import this
# function in your module. The program stops when the
# user enters the message "q".

import utils

condition = True
inputs = []
primes = []
ints = []
while condition is True:
    inp = input()
    if inp == "q":
        break
    inputs.append(inp)

for element in inputs:
    try:
        ints.append(int(element))
    except ValueError:
        pass

for element in ints:
    primes.append(utils.process_item(element))

print(primes)

コード例 #16
0
ファイル: app.py プロジェクト: Andrei2498/Laboratoare-Python
import utils

if __name__ == '__main__':
    while True:
        input_received = input()
        if input_received == 'q':
            break
        else:
            print(utils.process_item(int(input_received)))