print("Welcome to the Mad Libs Casino! Please pay a coin to play.") # welcoming user ask = input("Do you want to play: Reply with yes, or no.") if ask == "no": print("Then why did you run this program in the first place? You're still\n going to play.") if ask == "yes": name = "" # […]
Tag: Python Programming
Python Index
Indexes are perfect to use in Python when you have to locate a certain part in a string. For example: In the code above, abc is put into index of abc. The quotations say b, so where is b? Start from the start, and count. a is 1, space is 2, b is 3. So […]
Python Lists
Python lists can be extremely useful. What is a list? A list holds elements together. Example: The element “hi” is element 0. “hello” is number 1. So the first element we see is actually the 0th element in Python. What you can do to a list: (result is below) Also:
Python Order of Operations
In math, we use order of operations. Multiplication and division goes first, unless brackets, then addition and subtraction. Python also has them, just with more rules. The order of operations goes from highest to lowest rank, in order: parentheses ( 1+1 ) * 2 exponents 1 ** 2 unary plus and minus +a, -a multiplication, […]
‘Python Lottery’ Explanation
Key: italic is for python functions and bold is for variables. First: The # signs represent a comment. Comments can help someone understand the code. It’s like a silvery ghost. import random indicates that random will be used in this code to help choose random numbers for the lottery. When you don’t use this, import […]
Why The Lottery Tricks You
You might have thought that the lottery is pretty cool, right? You only spend a speck of your money and can get more! And you have a big chance of winning the money because you get to choose more than 1 number, right? Well, that might be what most people think, but the lottery has […]
DMOJ-Special Day 3p
Question: February 18 is a special date for the CCC this year. Write a program that asks the user for a numerical month and numerical day of the month and then determines whether that date occurs before, after, or on February 18. If the date occurs before February 18, output the word Before. If the date […]
More Python (If You’re Interested)
OK, since you’ve learned some Python from my previous blog, let’s see if you’ve sucked up all of my information. Sorry, no hints! This is a test (Maybe not, but I’m just expressing myself.) . I’ll present you a DMOJ question and if you like, as a “test”, you can install a Python 3 file […]
Diving Deep in Python
Well, today I dove deeper into Python 3 and tried some new functions. It’s pretty hard, so if you are not that experienced, you may want to learn the basics of this language. You could read one of my past blogs about the very first Python basics. Let’s get started now. DMOJ Problem In DMOJ, […]
A Bit of Coding In Python
If you want to write “Hi”, do this: If you want to write “Hello”, just replace “Hi” with “Hello” and so on.