Answers for "child game"

0

child game

def game(x):
    return (10*(x%10))+int(x/100)

size=int(input("Enter the size of array "))

if size<0 or size>20:
    print("Invalid input")
else:
    a=[]
    flag=True
    print("Enter the elements into the array")
    for i in range(size):
        t=int(input())
        if t<100 or t>999 :
            flag=False
            break
        a.append(game(t))
    if flag:
        print(a)
    else:
        print("Enter a valid input")
Posted by: Guest on June-08-2021
0

child game

def game(x):
    return (10*(x%10))+int(x/100)

size=int(input("Enter the size of array "))

if size<0 or size>20:
    print("Invalid input")
else:
    a=[]
    flag=True
    print("Enter the elements into the array")
    for i in range(size):
        t=int(input())
        if t<100 or t>999 :
            flag=False
            break
        a.append(game(t))
    if flag:
        print(a)
    else:
        print("Enter a valid input")
Posted by: Guest on June-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language