Skip to content
Permalink
Browse files
Added homework.
  • Loading branch information
Sergiu Harjau committed Jan 25, 2019
1 parent 9be8313 commit 400fd3499cfb30a02ed1e7b15e90a041e3311f0d
Showing 1 changed file with 38 additions and 0 deletions.
@@ -0,0 +1,38 @@
def scanID(studentID):
"""Takes as input a student ID, returns desired digit"""
desiredDigits = ["3", "4", "5", "6"]
for digit in str(studentID):
if digit in desiredDigits:
return (int(digit))
return 3

def receiveInput():
"""Returns name, sid string tuple"""
name = input("Name? ")
sid = input("StudentID? ")

return name, sid

def createOutput(name, sid):

size = scanID(sid)
i = 1
name = name.replace(" ", "+")

for letter in name:
print(letter, end = " ")
if i % size == 0:
print()
i += 1

while (i-1) % size != 0:
print("*", end = " ")
i += 1

print()


if __name__ == "__main__":
name, sid = receiveInput()
createOutput(name, sid)
createOutput(name[::-1], sid)

0 comments on commit 400fd34

Please sign in to comment.