Share your repls and programming experiences

← Back to all posts
An Annoying Thing
IndyCarter (55)

It's very annoying!
I just thought of making it...

I want to thank @LizFoster and @ChezTacoz for helping me with while loops

Commentshotnewtop
ChezTacoz (8)

@IndyCarter You can always do this

count=0

on=True
while on:

print("1234567890987654321")
input("Hi, my name is Bob")
print('jdfksdjljdsldskljgfkdguery57rtuihgrfjkdtueiytuiihgglfhufghxuigxfhjgfjfkdhdf')
input('I dont know what that means... do you?')
print('(Click Enter)')
if count==(number of times you want it to repeat):
print("(Don't Click Enter)")
print("ERROR!!!!!! ERROR!!!!!!")
print("......")

of course you also need to indent it properly
so indent everything past the while loop and if statement

ChezTacoz (8)

It's very interesting but for future reference you can just use a while loop

IndyCarter (55)

ok @ChezTacoz but i dont really know while loops :(

LizFoster (113)

@IndyCarter to do a while loop for this, all you have to say is:

while True:
print("1234567890987654321")
input("Hi, my name is Bob")
print('jdfksdjljdsldskljgfkdguery57rtuihgrfjkdtueiytuiihgglfhufghxuigxfhjgfjfkdhdf')
input('I dont know what that means... do you?')
print('(Click Enter)')

Indent everything past the 'while True:' part

hope this helps ^ ^*

IndyCarter (55)

question @LizFoster ...what does that do?

LizFoster (113)

@IndyCarter a while loop basically just goes over a few lines of code over and over again until some kind of condition is fulfilled! In this case, saying 'while True:' makes it so that it will loop forever.

IndyCarter (55)

ok thank u @LizFoster !
But how do you make it say
(dont click enter)
ERROR!!!! ERROR!!!!
........
at the end?

LizFoster (113)

@IndyCarter well, how many times do you want it to loop before saying that? it'll be easier if i write it as a program and send you a link.

LizFoster (113)

@IndyCarter for however many loops you want, just set the count variable to that number:
https://repl.it/@LizFoster/Annoying-Machine

IndyCarter (55)

ok thank u @LizFoster
I will (and have)

nt998302 (98)

@LizFoster you can do single line while loops...

while True: print(); print
#xD
LizFoster (113)

@nt998302 Ah, good point. I'm just not a fan of them, since they are harder to read when you have a lot of things to loop over.

nt998302 (98)

@LizFoster Yea. One time I had to do an assignment in 10 lines for bonus credit, but I put all the if/else statements on one line and I finished in 7 lines xD

nN34398Ff (66)

hahahahaha my stupid self pressed enter anyway that's whyg I should not save the world:

Evil boi: "Pressing this button will destroy the world!! You better not press it if you value your planet and everyone who lives on it!
Me: Thinks about how brother did not help with homework
Me: Needs revenge
Evil boi: Oh, my coffee is cold. I better heat it up again.
Me:

=)

Reporter: "It is a nice day with sun and birds singing and a gentle breeze"
World: no more while True for you, child

IndyCarter (55)

So deep but I don’t get it.... @nN34398Ff

StudentFires (14)

For future reference, don't write "PLEASE UPVOTE!!" in your post, also, writing that it's by 'your name here' is usually redundant, unless you're giving credit to the original author/developer.

gameplayrawesom (110)

What is the meaning of this????

IndyCarter (55)

But it's something @gameplayrawesom!!!!
And by the way great job on your Space Invaders :)