Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving Test Lulokal Intern - Angger Ary #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lulokal_solving/solving1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'''
run => python solving1.py
after running you can input words with separated (dont use space only separated)
and this program will be sort by abjad
'''
words = raw_input("enter words, comma separated = ")
words = words.split(',')
print(','.join(sorted(words)))
27 changes: 27 additions & 0 deletions lulokal_solving/solving2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'''
run = python solving2.py
and you can input with command = UP (value), DOWN (value), RIGHT (value), LEFT (value)
example = UP 5
*Note = just separate use space
and enter will close or end input
'''
START_POINTS = (0,0) #x,y
end_points = [0,0]
def get_distance(start,end):
dist = ((end[0] - start[0]) + (end[1] - start[1])) ** 0.5
return dist
while True:
move_point = raw_input().upper()
move = move_point.split(' ')
if move[0] == 'UP':
end_points[1] += int(move[1])
elif move[0] == "DOWN":
end_points[1] -= int(move[1])
elif move[0] == "RIGHT":
end_points[0] += int(move[1])
elif move[0] == "LEFT":
end_points[0] -= int(move[1])
if move_point == '':
distance = get_distance(START_POINTS, end_points)
print ("Then, the output of the program should be: ", round(distance))
break
16 changes: 16 additions & 0 deletions lulokal_solving/solving3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'''
run = python solving3.py
input name,age,height
*just separate with comma
enter for end or closing input and this program will be show output
'''
Tuples = []
while True:
input_tupl = raw_input('name,age,height = ')
if input_tupl != '':
tupl = input_tupl.split(',')
tupl [1], tupl [2] = int(tupl[1]), int(tupl[2])
Tuples.append(tuple(tupl))
elif input_tupl == '':
print('\n',sorted(Tuples))
break