Python Tutorial - Magic 8 Ball

  Рет қаралды 17,599

Geek Tutorials

Geek Tutorials

Күн бұрын

Пікірлер: 44
@alexandrafourie3521
@alexandrafourie3521 4 жыл бұрын
You have just saved me from failing my Coding homework :)
@shojauddin2509
@shojauddin2509 3 жыл бұрын
you could use arrays
@jackyhao470
@jackyhao470 4 жыл бұрын
very useful helped me cheat on my homework =)
@GeekTutorials1
@GeekTutorials1 4 жыл бұрын
That's what I'm here for!
@outlandishdude1832
@outlandishdude1832 3 жыл бұрын
Hello sir...can you provide me the flowchart for this program 🙏
@Moonsong02
@Moonsong02 Жыл бұрын
great tutorial!
@GeekTutorials1
@GeekTutorials1 Жыл бұрын
Thanks!
@bitchpudding2945
@bitchpudding2945 3 жыл бұрын
You should’ve added a second question... it gives you and answer for the first question, but it gives you a syntax error message when you type in the second question for some reason
@GeekTutorials1
@GeekTutorials1 3 жыл бұрын
Talk to me, Bitch Pudding. What's the error say exactly? We can fix it! Relax
@bitchpudding2945
@bitchpudding2945 3 жыл бұрын
@@GeekTutorials1 Literally syntax error I copied everything to last T, and my first question gave me a response. Then I remeber typing in "Will I grow bald", and the program highlighted the "I" and said syntax error
@bitchpudding2945
@bitchpudding2945 3 жыл бұрын
import random ans1 = "It is certain" ans2 = "It is decidedly so" ans3 = "Without a doubt" ans4 = "Yes - definitely" ans5 = "You may rely on it" ans6 = "As I see it, yes" ans7 = "Most likely" ans8 = "Outlook good" ans9 = "Yes" ans10 = "Signs point to yes" ans11 = "Reply hazy, try again" ans12 = "Ask again, later" ans13 = "Better not tell you now" ans14 = "Cannot predict now" ans15 = "Concentrate and ask again" ans16 = "Don't count on it" ans17 = "My reply is no" ans18 = "My sources say no" ans19 = "Outlook not so good" ans20 = "Very doubtful" name = input("Enter your name: ") input(name + ", What is your question for the Magic 8 Ball? ") choice = random.randint(1,20) if choice == 1: answer = ans1 elif choice == 2: answer = ans2 elif choice == 3: answer = ans3 elif choice == 4: answer = ans4 elif choice == 5: answer = ans5 elif choice == 6: answer = ans6 elif choice == 7: answer = ans7 elif choice == 8: answer = ans8 elif choice == 9: answer = ans9 elif choice == 10: answer = ans10 elif choice == 11: answer = ans11 elif choice == 12: answer = ans12 elif choice == 13: answer = ans13 elif choice == 14: answer = ans14 elif choice == 15: answer = ans15 elif choice == 16: answer = ans16 elif choice == 17: answer = ans17 answer = ans18 elif choice == 19: answer = ans19 else: answer = ans20 print("Magic 8 Ball: ", answer)
@GeekTutorials1
@GeekTutorials1 3 жыл бұрын
@@bitchpudding2945 Copy and paste the error here. It will tell you what line the error is on and what might be causing the issue.
@bitchpudding2945
@bitchpudding2945 3 жыл бұрын
@@GeekTutorials1 Will I eat cake? SyntaxError: invalid syntax
@pietraolegal
@pietraolegal 4 жыл бұрын
How to make it repeat the first process? Then i dont need to open the file all the time i want to test it
@GeekTutorials1
@GeekTutorials1 4 жыл бұрын
You'll need to use an endless loop for the main part of the code. To do this, you use the "While True" statement. You'll have to do some research on this.
@pietraolegal
@pietraolegal 4 жыл бұрын
@@GeekTutorials1 thanks
@bitchpudding2945
@bitchpudding2945 3 жыл бұрын
Somehow I did all of that but when I tried to run it, I got a syntax error... dislike
@GeekTutorials1
@GeekTutorials1 3 жыл бұрын
Hey Bitch - what's the error say? Syntax errors are easy to get rid of.
@srenjensen3817
@srenjensen3817 4 жыл бұрын
how about: 'import 8_ball' ?
@Mujiboy
@Mujiboy 3 жыл бұрын
That doesn't work with python idle XD
@distant6606
@distant6606 3 жыл бұрын
i mean you could have made it faster with random.choice or randint with the questions in a list
@levchegochev6086
@levchegochev6086 5 жыл бұрын
Its not working
@GeekTutorials1
@GeekTutorials1 5 жыл бұрын
It does work. You will need to thoroughly check your code for where the issue could be. What's the error message you get?
@levchegochev6086
@levchegochev6086 5 жыл бұрын
@@GeekTutorials1 I don`t get an error ,it asks my name then whats my question for the 8 ball and then nothing happens
@GeekTutorials1
@GeekTutorials1 5 жыл бұрын
@@levchegochev6086 Interesting. There would be something missing from your code, but I'm not sure what exactly. I've completed this tutorial with many students and it works every time. I hope you find the issue.
@levchegochev6086
@levchegochev6086 5 жыл бұрын
Geek Tutorials I copy all your code don’t know what’s the problem :/
@xwizdom9627
@xwizdom9627 5 жыл бұрын
are you using python 3?
@brokenblade5992
@brokenblade5992 2 жыл бұрын
Don’t try it with replit
@anthonyhicks6950
@anthonyhicks6950 4 жыл бұрын
is it just me or does he sound like jason statham
@GeekTutorials1
@GeekTutorials1 4 жыл бұрын
If only I looked like him too!
@iharvxyi6601
@iharvxyi6601 4 жыл бұрын
Teacher told me to like so I did opposite
@GeekTutorials1
@GeekTutorials1 4 жыл бұрын
Cheers, mate. You going this page is enough to keep the view count going up and the money rolling in.
Python Tutorial - While Loop - Count To 100
5:07
Geek Tutorials
Рет қаралды 4,5 М.
Python Tutorial - Multiple Choice Quiz
17:20
Geek Tutorials
Рет қаралды 84 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Python FAST API Tutorial
58:20
Tech With Tim
Рет қаралды 346 М.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Internet Made Coder
Рет қаралды 1,7 МЛН
Python Tutorial - For Loop - Passwords
8:38
Geek Tutorials
Рет қаралды 16 М.
How To Code Tic Tac Toe With Python | Programming Tutorial For Beginners
15:11
Intermediate Python Tutorial - Creating a Text Editor App
24:00
Tech With Tim
Рет қаралды 39 М.
ASMR Programming - Spinning Cube - No Talking
20:45
Servet Gulnaroglu
Рет қаралды 4,3 МЛН
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,4 МЛН
Creating Countdowns, Timers and Stopwatches In Linux
19:37
DistroTube
Рет қаралды 24 М.
ROCK PAPER SCISSORS game in Python 🗿
9:29
Bro Code
Рет қаралды 143 М.
Convert GUI App to Real Program -  Python to exe to setup wizard
23:27
Python Simplified
Рет қаралды 556 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН