~ Create a program using modulo arithmetic - modulo magic program in python


Creating a full program with a registration feature and login, and some modulo magic!

This program makes use of the creation of modulo arithemtic as well as simple file handling, such as writing the scores to file, and then sorting the file

What is Modulo arithmetic? Well, this university challenge video may get your juices flowing and wanting to know more!

Challenge -Create a modulo magic program. Include login and registration screen + modulo maths magic

Read the task instructions that are included in the comments in the code, and then get started!

You can either edit and code online in repl.it or alternatively, you can simply cut and paste the below into your own python file

Solve the challenge on repl.it

Code

""" ==============TASK
If a user wants to be inspired by some modulo magic, they need to first register and then login.
The modulo magic function has been created already, but you need to code the login and register
subroutines that the user must get through before getting to the magic!

1. Register - allow a user to sign up with a username and password
2. These details are written to a file called logininfo.txt
3. When logging in, the user must enter their username and password and it should match the file records

"""

def mainmenu():
    print("""
=========MAIN MENU========""")
    print("+-------------------------------------+")
    print("|  Please select an option:                      |")
    print("| 1 - Register                                        |")
    print("| 2 - Login                                            |")
    print("| 3- Quit                                               |")
    print("----------------------------------------")



def magic()
    #solution to modulo arithemetic magic using lists
    days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
    enterday=input("Enter day of week:")
    enternumber=input("Enter no. of days:")
    day_number = days.index(enterday)
    offset = enternumber
    print(days[(day_number + int(offset)) % 7])
  

mainmenu()


Check out these two videos- more on modulo arithmetic and a google interview. What does it have to do with modulo arithmetic?


Code your solution here

Systems Life Cycle (in a nutshell): Analyse - Design - Create - Test - Evaluate. Designing something or writing out some pseudocode before you actually write code is always a good idea! Get in to the habit of doing so! You can draw your flowchart here and screenshot it.

A sample flow chart (design) for this particular challenge could look like:

Flowchart: Python program to get the Fibonacci series between 0 to 50
Each challenge section below provides an online drawing tool where you can dynamically create flowcharts. Screenshot them into your presentation for submission.

Solutions & Answers

Answers /Solutions in the "members area" drive under: "Solve and Learn >>SOLUTIONS"

Testing Table

You may want to read a little about Testing first. A teacher may go through some examples with you. Feel free to fill in the test table here, and screenshot it in to your powerpoint. Testing is absolutely essential once you have created a program!
Test No. Description Test Data(input) Expected Outcome Actual Outcome Further Action?
1
2
3
4
5
Coming soon!