Gaming How to conver code to an algorithm?

kevan

Imagination rules the world
OP
Member
Joined
Dec 4, 2009
Messages
1,378
Trophies
0
Age
30
Location
Place
Website
Visit site
XP
506
Country
Code:
import time

while True:
value = int(input("Anti-Bot Test: Enter a number under 5 (leave blank to quit): "))
if not value:
break
elif value < 5:
print ("Passed")
break
else:
print ("Failed")

if value:
username = input("Enter Username: ")
password = input("Enter Password: ")
password2 = input("Re-enter Password: ")


while (password != password2):
print ("Second password doesn't match the first password")
print ("Re-enter your original password")
password2 = input("")
dob = input("Date of Birth: ")
print ("Review the following information")
time.sleep(1)
print ("You would like your username to be: %s" % (username))
print ("Your date of birth is: %s" % (dob))
y=['yes']
yn=str(input("Type yes to confirm information or no to revise it: "))
if yn in y:
print ("Thank you for registering")
I need it if they type no they go back to entering their username. Also if they type anything else except 'yes' or 'no' it tells them that is wrong and to type 'yes or 'no' again.
Thanks for the help so far guys :yaynds:
This is the code I have and I'm curious on how I would convert it back to an Algorithm? Also the question I have there in the quote. Any help with that please! :)
 

kirlac

Well-Known Member
Newcomer
Joined
May 17, 2009
Messages
49
Trophies
1
Age
37
Website
Visit site
XP
143
Country
New Zealand
Since an algorithm is just the step by step of what needs to happen you just read the code and write what each part is doing eg.
In a loop
Take in input to determine user is not a bot
Check if input is less than 5
etc.

As for the question, perhaps use some while loops eg.
create variable repeating set to true
while repeating
enter login
ask question
while answer is not yes or no
ask question again
if answer is yes
do yes scenario
set repeating to false
else set repeating to true
end loop
end loop

EDIT: Forgot to create repeating variable (initialized as true) and set it to false when doing the yes sceneario to prevent infinite loop.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • A @ armaldodo:
    There is nothing about on how getting the metapack.dtz for mario64 or any game, i only need that for inject mario 64 rom hacks into the n64 online.
  • K3Nv3 @ K3Nv3:
    No roms on the site
    +1
  • BigOnYa @ BigOnYa:
    I already told them the same earlier, if they keep it up, gonna get banned.
  • K3Nv3 @ K3Nv3:
    Friend showed me his bank account don't know why he got mad when I took a picture of his routing number
    +1
  • BigOnYa @ BigOnYa:
    Can't do much w a routing # anyways, it just shows where you bank basically
  • K3Nv3 @ K3Nv3:
    Click transfer now
    +1
  • BigOnYa @ BigOnYa:
    Even personal checks have your routing #, and your account # on them, but still not much can do with that info alone.
  • BigOnYa @ BigOnYa:
    My Nieghbor out of town, n I watching his house/ feeding his cats for him. This morn woke up n seen cops and ambulance at his house, so I walked over there just in time, they were bout to bust down his front door, said they got a 911 call then open line. So I open door n his house phone was off hook on kitchen counter. Somehow one his cats knocked phone off hook and dialed 911.
  • PandaPandel @ PandaPandel:
    guys i am alive
  • Sicklyboy @ Sicklyboy:
    @PandaPandel, holy moley, long time no see!
    +1
  • K3Nv3 @ K3Nv3:
    @Sicklyboy, haven't seen you in forever
    +1
  • Sicklyboy @ Sicklyboy:
    Crawling under the blankets and going to sleep and never waking up
  • PandaPandel @ PandaPandel:
    i am doing ok
    +1
  • PandaPandel @ PandaPandel:
    i think things are getting better
    +1
  • K3Nv3 @ K3Nv3:
    Damn forgot to cancel my paramount membership charged me $8
  • K3Nv3 @ K3Nv3:
    @Sicklyboy, how bad is it to buy a refurbished ups
  • Sicklyboy @ Sicklyboy:
    @K3Nv3, not bad at all, just make sure it comes with new batteries or else you'll have to put new ones in it yourself (not hard)
  • Sicklyboy @ Sicklyboy:
    UPS in my server rack is a 20 year old APC rackmount unit that I bought off ebay and threw like $60 of Amazon batteries in lol, fucker's mint
  • K3Nv3 @ K3Nv3:
    CyberPower is probably glued in
  • Sicklyboy @ Sicklyboy:
    Doubt it, I had a tiny cheap cyberpower one a few years ago and that one wasn't
  • K3Nv3 @ K3Nv3:
    Seen them cheap but eh $40 difference
    K3Nv3 @ K3Nv3: https://www.howtogeek.com/asus-nuc-15-pro-plus-debut/