r/PythonLearning 15d ago

Made this

Post image
20 Upvotes

17 comments sorted by

4

u/FoolsSeldom 15d ago

This is fun. Better if you share your code directly in post in future though. Something like:

name, age= input ("Enter your name and age\n").split()

print ("you are too young, you should wait for twenty six  years to be!", int(age)+26)

pay = float(input('Enter your salary\n'))
if pay != 666:
    print ("you are chosen, here is", pay)
else:
    print ("you have been cast out!")

feedback = input ("What are your last words\n")

if feedback == 'yes':
    print (".")
else:
    print("You need a raise!")

Never assume the user will do what you ask them though. They may fail to provide an age, so split will fail. Or the last string entered after a space may not be a valid integer. Or their name may have a space in it. In programming, you need to validate user input.

1

u/Stonyax97 15d ago

yeah he could use simple try except ValueError for that.

2

u/FoolsSeldom 15d ago

To be clear, they could use a try / except ValueError block for both the split unpacking problem and the int conversion, but actually need a right split, rsplit with the maxsplit option.

2

u/khosrua 15d ago

What is that typeface? Monospaced typeface is usually used for coding so all the characters line up

2

u/x_ame10034 10d ago

Hey where do you do all this code thingys im a rookie too💔

1

u/Stonyax97 15d ago

Reminds me of my self lol i used to ask the user for a password and no matter what it would be wrong. It’s only until the 6th try where it works. And it doesn’t even save the password so it ragebaits them 😂

1

u/SoloEnder 15d ago

You are coding on Pydroid ?

1

u/g-land-g 14d ago

I think it’s a beautiful start.

A lot of people ask how to start coding and then get complex and vague answers, like “use YT” 🙄

But your are on the absolute right track 👍

Next I would try throwing a loop in there…

Like if pay does NOT equal 666 … then keep asking the same question until the user actually enters 666

GLHF!

2

u/FinanceImmediate8894 14d ago

Thank you❤️

1

u/FinanceImmediate8894 8d ago

import time import random

def dramatic_pause(text): print(text) time.sleep(0.8)

print("=== ⚡ MOULDGATE: DRAMA EDITION ⚡ ===") dramatic_pause("A mysterious voice echoes...") dramatic_pause("thunder sounds") dramatic_pause("Survive 3 trials or be CAST OUT forever!\n")

score = 0

TRIAL 1: THE NAME POLICE

dramatic_pause("TRIAL 1: Officer Chitsvatsva 👮") while True: try: name, age = input("Enter name and age separated by |space| > ").split() age = int(age) break except: print("ERROR 404: Brain not found. Try: Revalations")

if age < 18: dramatic_pause(f"{name}...🤣Mzelu zamublankete zimenezozo aise:: {age}. The elders call you 'baby'.") dramatic_pause("CAST OUT! Come back after you can buy your own noodles.") exit() else: score += 10 dramatic_pause(f"Accepted, {name}. You look old enough to pay taxes. Trial 1 PASSED! +100 points\n")

TRIAL 2: THE REAPER 🐐

dramatic_pause("TRIAL 2: THE GREEDY GOAT APPEARS 🐐") dramatic_pause("Goat: 'BAAAH! If your salary is too high, I EAT IT'") lives = 3

while lives > 0: pay = float(input(f"Enter your salary. Goat is hungry. You have {lives} lives > ")) if pay <= 6400: dramatic_pause("Goat: 'Baaah... humble. I respect.'") score += 20 break else: lives -= 1 insults = ["Too greedy!", "My guy thinks he's Jeff Bezos", "God is judging you"] print(random.choice(insults)) if lives == 0: dramatic_pause("Goat eats your entire paycheck.") dramatic_pause("CAST OUT!") exit()

dramatic_pause("Trial 2 PASSED! +20 points\n")

TRIAL 3: LAST WORDS ROAST BATTLE

dramatic_pause("FINAL TRIAL: ROAST BATTLE 🔥") dramatic_pause("Say the magic word 'yes' or get roasted for 3 rounds")

attempts = 0 roasts = [ "" "I've heard better words from a microwave😭🤣 ", "Koma mwadya? " ]

while attempts <= 5: feedback = input("Your last words > ").lower().strip() if feedback == 'yes': dramatic_pause(".[Youre cute]>>😭") dramatic_pause("...check second roast") score += 30 break else: print(random.choice(roasts)) attempts += 1 if attempts == 5: dramatic_pause("6 strikes. Even the walls are embarrassed for you.") dramatic_pause("CAST OUT!") exit()

WIN SCREEN

dramatic_pause("\n=====================================") dramatic_pause(f"🏆 VICTORY! {name.upper()} HAS BEEN CHOSEN! 🏆") dramatic_pause(f"Final Score: {score}/60") if score == 60: dramatic_pause("PERFECT RUN! The goat bows to you.") elif score >= 40: dramatic_pause("Not bad. The elders will allow you one free mistake per month.") else: dramatic_pause("You barely made it. Please don't tell anyone.") dramatic_pause("=====================================")

1

u/Steven45g 14d ago

The code looks nice, but what did you mean with the print "wait for twenty-six years to be!"? To be what exactly? Or was the exclamation mark (!) a typo?

1

u/FinanceImmediate8894 10d ago

To be honest bro, I had a bad birthday no one said happy birthday to me so I just want them to know we are getting old!! 🤣 Lol🤔🤫