I need help making a simple python program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help making a simple python program

Its a sad program that prints ('are you sad') and if you press Y it spams (i am sad) please help me

4th May 2018, 2:21 AM
Spoof.py
Spoof.py - avatar
18 Answers
+ 12
spam = input("Are you sad? ") print(spam + "\n") if spam == "yes": for x in range(0,20): print("You are sad")
4th May 2018, 12:30 PM
jay
jay - avatar
+ 9
If you keep going with your python course you should have no problems creating such a program. You will want to study user input, conditional statements and loops
4th May 2018, 2:30 AM
jay
jay - avatar
+ 7
I will get you started: spam = input("Are you sad? ")
4th May 2018, 3:34 AM
jay
jay - avatar
+ 5
Adrian: Go to your python course, and click 'Basic Concepts.' There is SImple Input and Output. Then in Control Structures, go to anything with loop in it.
4th May 2018, 2:42 AM
DrChicken24
DrChicken24 - avatar
+ 4
Can you show me what you have so far?? I think you need to import a module for key detection... Im not sure which one, though. Why do you want to create such a program, though :P
4th May 2018, 2:24 AM
DrChicken24
DrChicken24 - avatar
+ 3
Hey jay, those pages can't be found...
4th May 2018, 2:40 AM
DrChicken24
DrChicken24 - avatar
+ 3
Huh, it said those pages cannot be found for me...
4th May 2018, 2:43 AM
DrChicken24
DrChicken24 - avatar
+ 3
Alright, cool! If you require any more assistance, I am here! :)
4th May 2018, 2:44 AM
DrChicken24
DrChicken24 - avatar
+ 3
Try this... spam = input('ARE YOU SAD? ') if spam == 'yes': print('You are sad') else: print('You are not sad') The else statement is optional, you don't need it. But keep in mind that if the word YES is not an exact match to what the user types, it won't work. You can add to the if statement or add elif statements to account for other variations, like a capital Y, or all caps - YES. To make it spam the phrase, just multiply the print statement, like this... print('You are sad ' * 10) Side note: Finish the Python course and this should be no problem for you.
4th May 2018, 5:51 AM
synorax
synorax - avatar
+ 2
Can I see the code? You should just be able to do a while loop or if statement with user input.
4th May 2018, 3:19 AM
DrChicken24
DrChicken24 - avatar
+ 1
Were may i find this jay
4th May 2018, 2:32 AM
Spoof.py
Spoof.py - avatar
+ 1
Thx jay
4th May 2018, 2:37 AM
Spoof.py
Spoof.py - avatar
+ 1
DrChicken24 works just fine for me
4th May 2018, 2:40 AM
Spoof.py
Spoof.py - avatar
+ 1
Im working on it rn just editing some things atm DrChicken24
4th May 2018, 2:43 AM
Spoof.py
Spoof.py - avatar
0
ok if i want them to input yes how do i make it spam i am sad ?
4th May 2018, 3:12 AM
Spoof.py
Spoof.py - avatar
0
DrChicken24 yea print("ARE YOU SAD ?") spam = input (" ") print (spam) i just help to where they reply yes and it spams Your are sad
4th May 2018, 4:35 AM
Spoof.py
Spoof.py - avatar
0
synorax yea i had this at first but all it gave me an eoi error an error ive never seen
4th May 2018, 12:28 PM
Spoof.py
Spoof.py - avatar