Introducing Replit Teams
0:53
Ай бұрын
Replit Desktop App
4:43
7 ай бұрын
Deploy Your Project on Replit
6:13
The Changelog: July 24th 2023
3:11
The Changelog: July 5th 2023
4:19
10 ай бұрын
Пікірлер
@wittx1234
@wittx1234 Күн бұрын
Pretty easy compared to Top Trumps and some previous challenges. Although I didn't realize that file open() and close() should be in the loop at first... import os, time print("🌟HIGH SCORE TABLE🌟") while True: f = open("high.score", "a+") time.sleep(2) os.system("clear") initials = input("what's the three letter initials?:").strip().upper()[0:3] score = int(input("what's the score?:")) if score > 100000: print("no") continue f.write(f"{initials} {score} ") f.close() print() print("Added to high score table.") Add = input("add another?:") if (Add.strip().lower()[0]) == "y": continue else: print("end") break
@wittx1234
@wittx1234 Күн бұрын
Pretty easy compared to Top Trumps and some previous challenges: f = open("high.score", "a+") import os, time print("🌟HIGH SCORE TABLE🌟") while True: time.sleep(2) os.system("clear") initials = input("what's the three letter initials?:").strip().upper()[0:3] score = int(input("what's the score?:")) if score > 100000: print("no") continue f.write(f"{initials} {score} ") print() print("Added to high score table.") Add = input("add another?:") if (Add.strip().lower()[0]) == "y": continue else: print("end") break f.close()
@Nickc86
@Nickc86 Күн бұрын
Actually kinda genius, only problem is people would figure it out quick
@IwujiGoodluck
@IwujiGoodluck Күн бұрын
Hey i dont use replit i watch it on youtube then i use vscode My point is i tried doing it without f.close( ) and it works
@SantiYounger
@SantiYounger 2 күн бұрын
thanks for the video, has this processed changed drastically since recording this?
@wittx1234
@wittx1234 2 күн бұрын
Too difficult for me. Literally need to ask ChatGPT to help: import random print("Top Trumps") print("Welcome to the Top Trumps 'Most Handsome Computing Instructor' Simulator") instructors = { "David": {"intelligence": 500, "attractiveness": 300, "coding_skills": 1000, "baldness": 400}, "Monke": {"intelligence": 200, "attractiveness": 300, "coding_skills": 700, "baldness": 50}, "Spongebob": {"intelligence": 100, "attractiveness": 200, "coding_skills": 500, "baldness": 200}, "Iennix": {"intelligence": 400, "attractiveness": 100, "coding_skills": 800, "baldness": 0} } while True: card1_name, card1_stats = random.choice(list(instructors.items())) card2_name, card2_stats = random.choice(list(instructors.items())) print("Choose your card:") print("1. ", card1_name) print("2. ", card2_name) chosen_card = input("> ") if chosen_card == "1": chosen_card_name, chosen_card_stats = card1_name, card1_stats elif chosen_card == "2": chosen_card_name, chosen_card_stats = card2_name, card2_stats else: print("Invalid choice!") continue print(f"Choose your stat for {chosen_card_name}:") print("1. Intelligence") print("2. Attractiveness") print("3. Coding Skills") print("4. Baldness") chosen_stat = input("> ") if chosen_stat not in ["1", "2", "3", "4"]: print("Invalid choice!") continue stat_names = ["intelligence", "attractiveness", "coding_skills", "baldness"] chosen_stat_name = stat_names[int(chosen_stat) - 1] print(f"{chosen_card_name} has a {chosen_stat_name} stat of {chosen_card_stats[chosen_stat_name]}") opponent_card_name, opponent_card_stats = random.choice(list(instructors.items())) opponent_stat_value = opponent_card_stats[chosen_stat_name] print(f"{opponent_card_name} has a {chosen_stat_name} stat of {opponent_stat_value}") if chosen_card_stats[chosen_stat_name] > opponent_stat_value: print(f"{chosen_card_name} wins!") elif chosen_card_stats[chosen_stat_name] < opponent_stat_value: print(f"{opponent_card_name} wins!") else: print("It's a tie!") again = input("Play again? (yes/no): ").strip().lower() if again != "yes": print("End game!") break
@CheggBoy-qi9oc
@CheggBoy-qi9oc 4 күн бұрын
you guys change this shit every month it feels like i cant find it now
@RichOnStream
@RichOnStream 5 күн бұрын
Yeah I think I'm going to skip this one. I have no issues with the coding, it's images that are specific to my story that I can't seem to find or AI generate.
@wittx1234
@wittx1234 5 күн бұрын
Didn't include the color function because its complicated (it turns every MokeBeasts into the same color after I finished): print("MokéBeast") print() MokéBeast = {} def prettyPrint(): print() for key, value in MokéBeast.items(): print(key, end=" | ") for subKey, subValue in value.items(): print(f"{subKey: ^5}" , end=": ") print(f"{subValue: ^5}", end=" | ") print() while True: name = input("name: ").strip().lower() type = input("type: ").strip().lower() special_move = input("special move: ").strip().lower() HP = input("HP: ").strip().lower() MP = input("MP: ").strip().lower() MokéBeast[name] = {"type": type, "special move": special_move, "HP": HP, "MP": MP} Again = input("Again?:") if (Again.strip().lower()[0]) == "y": continue else: break print() prettyPrint()
@LenovoLenovo-re3ic
@LenovoLenovo-re3ic 5 күн бұрын
Idk but this tutorial and the tutor both are great, you'll learn everything without getting bored!
@RichOnStream
@RichOnStream 6 күн бұрын
For those who are just starting this journey and don't know where the files are... In the "Files" pane, click the three dots next to "New File" and "New Folder", click show hidden files from the drop-down menu and the "Tutorial" files will show. Click on Tutorial and the "Guess Who" image files will show there. If your struggling to find them, the file locations are; .tutorial/Guess Who/charlotte.jpg .tutorial/Guess Who/gerald.jpg .tutorial/Guess Who/katie.jpg .tutorial/Guess Who/mo.jpg Below is my code for the program. import tkinter as tk from PIL import Image, ImageTk window = tk.Tk() window.title("Guess Who?") window.geometry("500x250") label = "Guess Who?" def showImage(): person = textBar.get("1.0", "end") if person.lower().strip() == "charlotte": canvas.itemconfig(container, image = charlotte) elif person.lower().strip() == "gerald": canvas.itemconfig(container, image = gerald) elif person.lower().strip() == "katie": canvas.itemconfig(container, image = katie) elif person.lower().strip() == "mo": canvas.itemconfig(container, image = mo) else: hello["text"] = "Sorry, I can't find that person." hello = tk.Label(text = label) hello.pack() textBar = tk.Text(window, height = 1, width = 20) textBar.pack() button = tk.Button(text = "Find", command=showImage) button.pack() canvas = tk.Canvas(window, width = 400, height = 180) canvas.pack() charlotte = ImageTk.PhotoImage(Image.open(".tutorial/Guess Who/charlotte.jpg")) gerald = ImageTk.PhotoImage(Image.open(".tutorial/Guess Who/gerald.jpg")) katie = ImageTk.PhotoImage(Image.open(".tutorial/Guess Who/katie.jpg")) mo = ImageTk.PhotoImage(Image.open(".tutorial/Guess Who/mo.jpg")) container = canvas.create_image(15, 1, image = mo) tk.mainloop()
@saviocoelho
@saviocoelho 6 күн бұрын
for my puny brain
@saviocoelho
@saviocoelho 6 күн бұрын
codeing is funnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
@AnotherTerribleIdea
@AnotherTerribleIdea 6 күн бұрын
I've done this and got them up and running on Twitter. Is there a way to set one up to work on BlueSky, as well? I'm guessing I just need to find out where to grab the API Key and Access Token info. Hmmm. Off to research!
@dineshdhanoki7236
@dineshdhanoki7236 7 күн бұрын
import random def guess_the_number(): target_number = 420000 attempts = 0 print("***Welcome to the number guessing game application*** ") print("Can you guess the correct number from 1 to 1000000 ") while True: try: player_guess = int(input("Enter the number you think is the correct number: (or Enter a negative value to exit the program/application): ")) if player_guess < 0: print("Thank you for playing the game of Guess the number. Exiting now as per your command: ") break attempts += 1 if player_guess == target_number: print(f"Congrats, You have guessed the correct number in {target_number} in {attempts} attempt(s).") break elif player_guess < target_number: print("You have guess the number too low. Please try again !!!") else: print("You have guess the number too high. Please try again !!!") except ValueError: print("You have entered invalid integer. Please enter Valid interger !!!") play_again = input("Do you want to play again?: (yes/no)").lower() if play_again != "yes": print("Thank you for using the application. See you soon") break if __name__ == "__main__": guess_the_number()
@elliria_home
@elliria_home 7 күн бұрын
Here's my take on the solution using colors for the different types of beasts: import os print("MokeBeasts Full-on Mokedex Add your beast! ") mokedex = {} colors = {"air":"\033[1;37m", "earth":"\033[33m", "default":"\033[0;00m", "fire":"\033[31m", "spirit":"\033[1;33m", "water":"\033[1;34m"} def pretty_print(): print(" Your beast's information is:") print() print(f"{'Name':^15}|{'Type':^15}|{'Move':^15}|{'HP':^15}|{'MP':^15}") for key, value in mokedex.items(): color = colors[value["Type"]] print(f"{color}{key:^15}", end="") for subkey, subvalue in value.items(): print(f"{color}|{subvalue:^15}", end="") print(colors["default"], end="") print() print() while True: beast_name = input("Beast name: ").strip().capitalize() beast_type = input("Beast type: ").strip().lower() beast_special_move = input("Beast special move: ").strip().lower() beast_starting_hp = input("Beast starting HP: ").strip() beast_starting_mp = input("Beast starting MP: ").strip() mokedex[beast_name] = {"Type": beast_type, "Move": beast_special_move, "HP": beast_starting_hp, "MP": beast_starting_mp} os.system("clear") pretty_print()
@mafiayadav-lp6qh
@mafiayadav-lp6qh 10 күн бұрын
name = input("whats your name:") if name == "ALEX" or name == "gon" or name == "goku": print(" hello there sir avery good morning ") print("\033[33m","do your best",name,"\033[34m","and never give up and keep hustling till u win") else: print("pls leave") some example codes
@user-if1dj7fy2y
@user-if1dj7fy2y 10 күн бұрын
Bravo 🌞 Lit 💡 Impressive 😍 gratitude for your satisfactory Work 🚀🌱🌟
@RichOnStream
@RichOnStream 11 күн бұрын
Very basic. I had to use Google a little bit and found the "lambda" helped a lot. import tkinter as tk window = tk.Tk() window.title("Calculator") window.geometry("300x300") answer = 0 finalNumber = 0 operator = None myCalc = tk.Label(text=answer) myCalc.grid(row=0, column=1) def typeAnswer(value): global answer answer = f"{answer}{value}" answer = int(answer) myCalc["text"] = answer def calcAnswer(thisOp): global answer, finalNumber, operator finalNumber = answer answer = 0 if thisOp == "+": operator = "+" elif thisOp == "-": operator = "-" elif thisOp == "*": operator = "*" elif thisOp == "/": operator = "/" myCalc["text"] = answer def calc(): global answer, finalNumber, operator if operator == "+": total = finalNumber + answer elif operator == "-": total = finalNumber - answer elif operator == "*": total = finalNumber * answer elif operator == "/": total = finalNumber / answer answer = total myCalc["text"] = answer one = tk.Button(text="1", command= lambda: typeAnswer(1)) one.grid(row=1, column=0) two = tk.Button(text="2", command= lambda: typeAnswer(2)) two.grid(row=1, column=1) three = tk.Button(text="3", command= lambda: typeAnswer(3)) three.grid(row=1, column=2) four = tk.Button(text="4", command= lambda: typeAnswer(4)) four.grid(row=2, column=0) five = tk.Button(text="5", command= lambda: typeAnswer(5)) five.grid(row=2, column=1) six = tk.Button(text="6", command= lambda: typeAnswer(6)) six.grid(row=2, column=2) seven = tk.Button(text="7", command= lambda: typeAnswer(7)) seven.grid(row=3, column=0) eight = tk.Button(text="8", command= lambda: typeAnswer(8)) eight.grid(row=3, column=1) nine = tk.Button(text="9", command= lambda: typeAnswer(9)) nine.grid(row=3, column=2) zero = tk.Button(text="0", command= lambda: typeAnswer(0)) zero.grid(row=4, column=1) add = tk.Button(text="+", command= lambda: calcAnswer("+")) add.grid(row=1, column=4) minus = tk.Button(text="-", command= lambda: calcAnswer("-")) minus.grid(row=1, column=5) mult = tk.Button(text="*", command= lambda: calcAnswer("*")) mult.grid(row=2, column=4) divide = tk.Button(text="/", command= lambda: calcAnswer("/")) divide.grid(row=2, column=5) equals = tk.Button(text="=", command= calc) equals.grid(row=4, column=4) tk.mainloop()
@RichOnStream
@RichOnStream 11 күн бұрын
Took me a while but I got there! Had issues with the expected arguments but figured it out. import time title = "Generic RPG" print(f"{title:^70}") time.sleep(1) print() class character: name = None health = 100 magicPoints = 100 def __init__(self, name): self.name = name def print(self): print(f"{self.name}\tH: {self.health}\tMP: {self.magicPoints}") def startStats(self, health, magicPoints): self.health = health self.magicPoints = magicPoints class player(character): gameName = None startLives = 4 def __init__(self, gameName): self.name = "Player" self.gameName = gameName def print(self): print(f"{self.name}\tH: {self.health}\tMP: {self.magicPoints}\tNickname: {self.gameName}\tLives: {self.startLives}") def notDead(self): if self.startLives > 0: time.sleep(1) print() print(f"{self.gameName} heart, is still beating!") time.sleep(1) print() return True else: print(f"{self.gameName} heart, has stopped!") return False richard = player("Richard the Lionheart's") richard.print() print(richard.notDead()) time.sleep(2) print() class enemy(character): type = None strength = None def __init__ (self, name, type, strength): self.name = name self.type = type self.strength = strength def print(self): print(f"{self.name}\tH: {self.health}\tMP: {self.magicPoints}\tType: {self.type}\tStrength: {self.strength}") class orc(enemy): speed = None def __init__ (self, speed): self.name = "Orc" self.type = "Orc" self.strength = 250 self.speed = speed def print(self): print(f"{self.name}\tH: {self.health}\tMP: {self.magicPoints}\tType: {self.type}\tStrength: {self.strength}\tSpeed: {self.speed}") PlayerSlayer = orc(300) SlowBoat = orc(220) TadSlower = orc(190) PlayerSlayer.print() SlowBoat.print() TadSlower.print() time.sleep(1) class vampire(enemy): day = True print() def __init__ (self, day): self.name = "Vampire" self.type = "Vampire" self.strength = 160 self.day = day def print(self): print(f"{self.name}\tH: {self.health}\tMP: {self.magicPoints}\tType: {self.type}\tStrength: {self.strength}\tDay: {self.day}") Sucker = vampire(False) Drainer = vampire(False) Sucker.print() Drainer.print()
@user-ex2fv7jj2x
@user-ex2fv7jj2x 11 күн бұрын
@jorgeyanez2142
@jorgeyanez2142 11 күн бұрын
I did the following but didn't need a Continue input. Not sure why it should have one (?) print ("Welcome to the guessing game!") print ("The instructions are very clear. You will guess a number between 1 and 1.000.000. If you guess the number correctly, you win. If you guess the number incorrectly, you lose.") print ("Let's begin!") print () print () #creating variables number= 482 counttries= 1 #creating a while loop while True: guess= int(input("What is your guess?: ")) if guess == number: print ("YOU HAVE WON!!!") break elif guess < number: print ("Too low!") counttries += 1 elif guess > number: print ("Too high!") counttries += 1 if guess < 0: print ("You have entered a negative number. You have lost.") exit() print ("You have won in",counttries,"tries")
@Mandarigaming
@Mandarigaming 12 күн бұрын
Dave actually missed the information about entering data 2-3 times. Furthermore, it should print that the list is completed after completing the loop. Look at my code: f = open("final.scorex.txt","a+") i = 0 while True: if i < 3: initials = input("Initials: ") score = input("Score: ") f.write(f"{initials} {score} ") i +=1 elif i == 3: print("The list is completed") break f.close()
@JessicaBarnum-bn7ow
@JessicaBarnum-bn7ow 12 күн бұрын
THE ONE PIECEEEEEEEEEEEE THE ONE PIECE IS REAAAAAAAAAAL!!!!!!! ~"Can we get much higherrrrr sooo highhhhhhh yo-ho-hoo~
@ryaneditzcold
@ryaneditzcold 12 күн бұрын
YOUR STUPID MAKE IT FREE
@wittx1234
@wittx1234 12 күн бұрын
Struggling with the viewing priority and edit section. print("🌟To Do List🌟") import os, time List = [] def Add(): task = input("What do you want to add to the list?:").strip().lower() due = input("when is it due by?:").strip().lower() priority = input("high, medium or low?:").strip().lower() row = [task, due, priority] List.append(row) print("Your list has been added!") def PrettyPrint(): for row in List: for item in row: print(item, end=" | ") print() def Priority(): view = input("do you want to view high, medium or low priority tasks?:").strip().lower() if view == "high": for row in List: if row[2] == "high": for item in row: print(item, end=" | ") print() elif view == "medium": for row in List: if row[2] == "medium": for item in row: print(item, end=" | ") print() elif view == "low": for row in List: if row[2] == "low": for item in row: print(item, end=" | ") print() def Edit(): task = input("what task do you want to edit?:").strip().lower() due = input("what is the due date you want to edit?:").strip().lower() priority = input("what is the priority that you want to edit?:").strip().lower() row = [task, due, priority] if row in List: List.remove(row) print("Your list has been removed.") task = input("what task do you want to change to?:").strip().lower() due = input("what due do you want to change to?:").strip().lower() priority = input("what priority do you want to change to?:").strip().lower() row = [task, due, priority] whichRow = int(input("Which row? "))#Needs to be int List.insert(whichRow, row) def Remove(): task = input("what task do you want to remove?:").strip().lower() due = input("what is the due date you want to remove?:").strip().lower() priority = input("what is the priority that you want to remove?:").strip().lower() row = [task, due, priority] if row in List: List.remove(row) print("Your list has been removed.") while True: Menu = input("do you want to add, view, edit or remove?:").strip().lower() if Menu == "add": Add() elif Menu == "view": view = input("do you want to view all or view priority?:").strip().lower() if view == "all": PrettyPrint() elif view == "priority": Priority() elif Menu == "edit": Edit() elif Menu == "remove": Remove() else: print("quit") break time.sleep(3) os.system("clear")
@Samuel-zs9gw
@Samuel-zs9gw 12 күн бұрын
3:44 By the way, "int" stand for integers
@TheHarryable
@TheHarryable 13 күн бұрын
Thought I’d mention that as of April 2024 hashing the same f string with hash() seems to produce different hash values in Replit if the program is stopped and restarted. This makes logging in to an existing user essentially impossible. A solution I found is to import hashlib and use it like this: import hashlib hashedPassword = hashlib.sha256(password.encode()).hexdigest() This should produce consistent hash values for the same f string across sessions.
@anthonym3254
@anthonym3254 19 сағат бұрын
OMG DUDE Life saver!
@petermaina5234
@petermaina5234 13 күн бұрын
print("\033[31mList Generator\033[0m") print() rangeStart = int(input("Input range start: ")) rangeStop = int(input("Input range limit: ")) increment = int(input("Input increment value: ")) for i in range(rangeStart, rangeStop, increment): print(i)
@petermaina5234
@petermaina5234 13 күн бұрын
print("List Generator") print() rangeStart = int(input("Input range start: ")) rangeStop = int(input("Input range limit: ")) for i in range(rangeStart, rangeStop, 20): print(i) # mine can ask for both the range start and the maximum number-rangestop
@RichOnStream
@RichOnStream 13 күн бұрын
Took me a while, had to re-watch the video 3 or 4 times until I understood lol I added colour and time delays as well as spaces between lines of code. import time BLUE = "\033[0;34m" CYAN = "\033[0;36m" END = "\033[0m" title = "=== JOBS BOARD ===" print(f"{BLUE}{title:^80}{END}") time.sleep(1) print() class job: name = None salary = None hoursWorked = None def __init__ (self, name, salary, hoursWorked): self.name = name self.salary = salary self.hoursWorked = hoursWorked def print(self): print(f"{CYAN}= JOB ={END}") print() print(f"{self.name:<10} {self.salary:^10} {self.hoursWorked:>9}") class doctor: experience = None speciality = None def __init__ (self, salary, hoursWorked, experience, speciality): self.name = "Doctor" self.salary = salary self.hoursWorked = hoursWorked self.experience = experience self.speciality = speciality def print(self): print() print(f"{CYAN}= JOB ={END}") print() print(f"{self.name:<10} {self.salary:^10} {self.hoursWorked:>9}") print(f"{self.experience:<10} {self.speciality:>14}") class teacher: subject = None position = None def __init__ (self, salary, hoursWorked, subject, position): self.name = "Teacher" self.salary = salary self.hoursWorked = hoursWorked self.subject = subject self.position = position def print(self): print() print(f"{CYAN}= JOB ={END}") print() print(f"{self.name:<10} {self.salary:^10} {self.hoursWorked:>10}") print(f"{self.subject:<10} {self.position:>11}") solicitor = job("Lawyer", "£120,000", "40") solicitor.print() time.sleep(1) doctors = doctor("£150,000", "50", "8 Years", "Brain Surgeon") doctors.print() time.sleep(1) teaching = teacher("£50,000", "50+", "ITC", "Head of IT") teaching.print()
@RichOnStream
@RichOnStream 13 күн бұрын
Another fairly simple one. The only issue I have is, after every entry, the user has to input the password again. if someone could have a look at where I've gone wrong, I'm sure it's pretty simple, it would be greatly appreciated. from replit import db import time import datetime import os title = "Personal Diary" def getPass(): if password == "Replit100-": print() print("You Now Have Access!") print() else: return def addNewEntry(): time.sleep(1) os.system("clear") print(f"{title:^60}") print() timeDateStamp = datetime.datetime.now() print(f"Diary Entry for {timeDateStamp}") print() diaryEntry = input("Please type your diary entry below Entry: ") db[timeDateStamp] = diaryEntry def viewDiaryEntries(): keys = db.keys() for key in keys: time.sleep(1) os.system("clear") print(f"{title:^60}") time.sleep(1) print() print(f"""{key} {db[key]}""") print() nextExit = input("See the next entry or Exit?: ") if (nextExit.lower() == "exit"): break def deleteEntries(): db.clear() print("Diary entries have been deleted.") time.sleep(1) print() os.system("clear") while True: os.system("clear") password = input("Please insert the password to gain access: ") time.sleep(1) if password == "Replit100-": getPass() else: print() print("Sorry, I can't give you access! Please rerun the program.") break print() print(f"{title:^60}") time.sleep(1) diaryMenu = input(" 1: Add Diary Entry 2: View Diary Entries 3: Delete Entire Entries Enter Option: ") print() if diaryMenu == "1": addNewEntry() elif diaryMenu == "2": viewDiaryEntries() else: deleteEntries()
@RichOnStream
@RichOnStream 13 күн бұрын
This was fairly simple. I also created a third option called "Delete Tweets". This clears the entire tweet database, just for the purpose of me wanting a clear slate. I will learn how to delete a specific tweet when I get the chance. import time from replit import db import datetime import os title = "Welcome to Tweeter" def addTweet(): tweet = input("Add Your Tweet: ") timeStamp = datetime.datetime.now() key = f"message{timeStamp}" db[key] = tweet time.sleep(1) os.system("clear") def viewTweet(): matches = db.prefix("message") matches = matches[::-1] counter = 0 for i in matches: print(db[i]) print() time.sleep(0.5) counter+=1 if (counter%10==0): nextTweets = input("Would you like to see the next 10 Tweets?: ") print() if (nextTweets.lower() == "no"): break time.sleep(1) os.system("clear") def deleteTweet(): db.clear() print("Tweets have been cleared.") time.sleep(2) print() os.system("clear") while True: print(f"{title:^60}") time.sleep(1) print() menu = input("What would you like to do? 1: Add Tweet 2: View Tweets 3: Delete Tweets Your Option: ") print() if menu == "1": addTweet() elif menu == "2": viewTweet() else: deleteTweet()
@CaptnMelanin
@CaptnMelanin 15 күн бұрын
I almost have to check solutions every time 😅 You can use the AI feature to explain why Mr. David writes any line of code. To know the function of some little pieces of code that confuse you.
@SS_24_
@SS_24_ 15 күн бұрын
How to off auto recommandation tags?
@wolfofbaystreet
@wolfofbaystreet 15 күн бұрын
I didn't make the apr cumulative, just added it at the end stand alone. not sure if correct. loan = 1000 apr = .05 apr_total = 0 for i in range(10): apr_total += (loan*apr) print (int(apr_total+loan))
@elliria_home
@elliria_home 16 күн бұрын
This was more challenging than it seemed at first because it required some things that hadn't been taught yet. That said, here's my solution that prints out a Bingo card that looks like David's example: # Import the necessary library: import random # Generate a list of 9 random unique numbers from 1 to 90: numbers = random.sample(range(1,91), 9) # Sort the numbers from lowest to highest: numbers.sort() # Replace the fifth number with the "BINGO" string: numbers[4] = "BINGO" # Create the table and populate it with slices of the numbers list: table = [numbers[0:3],numbers[3:6],numbers[6:9]] # Create a table row divider: table_row_divider = "-" * 20 # Create variables to hold the row and column values row1col1 = table[0][0] row1col2 = table[0][1] row1col3 = table[0][2] row2col1 = table[1][0] row2col2 = table[1][1] row2col3 = table[1][2] row3col1 = table[2][0] row3col2 = table[2][1] row3col3 = table[2][2] # Print the introduction: print("David's Nan's Bingo Card Generator ") # Pretty-print the table using f-strings to format it: print(f"{row1col1:^4} | {row1col2:^7} | {row1col3:^4}") print(table_row_divider) print(f"{row2col1:^4} | {row2col2:^7} | {row2col3:^4}") print(table_row_divider) print(f"{row3col1:^4} | {row3col2:^7} | {row3col3:^4}")
@JojoBojob
@JojoBojob 16 күн бұрын
Any place where we can download the code and play around with it?
@JojoBojob
@JojoBojob 17 күн бұрын
can't seem to get the bot to answer anything I write. Doesn't seem to be anything wrong with the code on first glance and the bot is online. How come? Anyone else have this problem?
@RichOnStream
@RichOnStream 17 күн бұрын
Added time delays too. import datetime import time title = "EVENT COUNTDOWN" print(f"{title:^60}") time.sleep(1) print() today = datetime.date.today() print(f"Todays Date is {today}") time.sleep(1) print() day = int(input("Please enter the Day your event is: ")) month = int(input("Please enter the Month your event is: ")) year = int(input("Please enter the Year your event is: ")) eventDate = datetime.date(year, month, day) difference = eventDate - today difference = difference.days if difference > 0: time.sleep(1) print() print(f"There is {difference} day(s) until your event!") elif difference < 0: print(f"Sorry! That event was {difference} day(s) ago! 😥😥😥") else: print("Your event is today! 🎉🎉🎉")
@RichOnStream
@RichOnStream 17 күн бұрын
I added time delays and colours. import time red = "\033[31m" blue = "\033[34m" yellow = "\33[33m" green = "\033[32m" magenta = "\033[35m" default = "\033[0m" title = "Palindrome Checker" print(f"{blue}{title:^60}{default}") time.sleep(2) print() palinWord = input(f"{magenta}Please choose a word you wish to check: {default}") time.sleep(1) print() print(f"{blue}You have chosen the word{default} - {yellow}{palinWord}{default}") time.sleep(1) print() print(f"{magenta}Now let's see if your chosen word is a Palindrome...{default}") time.sleep(2) print() def palindrome(word): if len(word)<=1: return f"Yes! {green}{palinWord}{default} is a Palindrome!" if word[0] != word[-1]: return f"Sorry, {red}{palinWord}{default} isn't a Palindrome." return palindrome(word[1:-1]) print(palindrome(palinWord))
@RichOnStream
@RichOnStream 17 күн бұрын
I spiced it up a bit by asking the person using the program to insert a number of their choice and using time delays. import time title = "Factorial Number Finder" print(f"{title:^60}") time.sleep(2) print() chosenNumber = int(input("Please choose a whole number: ")) time.sleep(1) print() print(f"You have chosen {chosenNumber}") time.sleep(1) print() def factorial(value): if value == 1: return 1 else: return value * factorial(value-1) answer = factorial(chosenNumber) print("Calculating your Factorial Number...") time.sleep(2) print() print(f"The Factorial Number of {chosenNumber} is {answer}")
@RichOnStream
@RichOnStream 17 күн бұрын
import csv import os import time title = "100 Most Streamed Songs" info = "Here are the 100 Most Streamed Songs on Blotify" print(f"{title:^80}") time.sleep(2) print() print(f"{info:^80}") time.sleep(2) print() with open("100MostStreamedSongs.csv") as file: reader = csv.DictReader(file) for row in reader: directory = os.listdir() artist = row["Artist(s)"].title() if artist not in directory: os.mkdir(artist) song = row["Song"] print(artist, "-", song) path = os.path.join(f"{artist}/", song) f = open(path, "w") f.close()
@RichOnStream
@RichOnStream 17 күн бұрын
Fairly simple. import time import os import random red = "\033[31m" blue = "\033[34m" yellow = "\33[33m" green = "\033[32m" magenta = "\033[35m" default = "\033[0m" title = "To-Do List Management System" info = "Welcome to our To-Do List Management System. We will ask a series of questions that will need to be answered in order to effectively manage your To-Do List." print(f"{green}{title:^80}{default}") time.sleep(1) print() print(f"{magenta}{info}{default}") time.sleep(2) print() toDoList = [] existingFile = True try: f = open("toDoList.txt", "r") toDoList = eval(f.read()) f.close() except: existingFile = False def add(): time.sleep(1) os.system("clear") print(f"{green}Add{default}") print() toDo = input("What would you like to add?: ") print() dueBy = input("When is it due?: ") print() priority = input("What is the priority level? High/Medium/Low: ").capitalize() row = [toDo, dueBy, priority] toDoList.append(row) print() print(f"{green}That has now to been added to the Management System{default}.") def view(): time.sleep(1) os.system("clear") viewOptions = input(f"1: {magenta}View All?{default} 2: {blue}By Priority{default} Enter your choice here: ") if viewOptions == "1": print() print(f"{magenta}View All{default}") for row in toDoList: for item in row: time.sleep(1) print(item, end=" | ") print() else: print() priority = input("Please choose which Priority you would like to search by. High/Medium/Low: ").capitalize() print() print(f"{blue}By Priority{default}") time.sleep(1) for row in toDoList: if priority in row: for item in row: time.sleep(1) print() print(item, end=" | ") print() time.sleep(1) def edit(): time.sleep(1) os.system("clear") print(f"{yellow}Edit{default}") print() search = input("What would you like to edit?: ") result = False for row in toDoList: if search in row: result = True if not result: time.sleep(1) print() print(f"{red}Sorry, I couldn't find that!{default}") return for row in toDoList: if search in row: toDoList.remove(row) toDo = input("What would you like to edit to to?: ") print() dueBy = input("When would you like to complete it by?: ") print() priority = input("What is the priority level? High/Medium/Low: ").capitalize() row = [toDo, dueBy, priority] toDoList.append(row) print() print(f"{green}That has now been edited{default}.") def remove(): time.sleep(1) os.system("clear") print(f"{yellow}Edit{default}") print() search = input("What would you like to remove?: ") for row in toDoList: if search in row: toDoList.remove(row) print() time.sleep(1) print(f"{green}That has now been removed{default}.") while True: menu = input(f"What would you like to do? 1: {green}Add{default} 2: {blue}View{default} 3: {yellow}Edit{default} 4: {red}Remove{default} Enter your option: ") print() if menu == "Add" or menu == "add" or menu == "1": add() print() elif menu == "View" or menu == "view" or menu == "2": view() print() elif menu == "Edit" or menu == "edit" or menu == "3": edit() print() else: remove() print() time.sleep(1) os.system("clear") if existingFile: try: os.mkdir("backups") except: pass name = f"backup{random.randint(1, 1000000000)}.txt" os.popen(f"cp toDoList.txt backups/{name}") f = open("toDoList.txt", "w") f.write(str(toDoList)) f.close()
@pankaj_sonawane8335
@pankaj_sonawane8335 18 күн бұрын
Thanks sir build replit Android app thanks for service
@SS_24_
@SS_24_ 15 күн бұрын
How to off auto recommandation tags?
@huntersaifgaming2244
@huntersaifgaming2244 18 күн бұрын
Which package to install if the code is not compiled?
@RyanMsotheremail
@RyanMsotheremail 19 күн бұрын
Due to the differences with how the Open AI platform work ( I think they may no longer offer the free trial without adding your credit card info to the site) I was unable to complete this project fully. I did play around with the concepts but ultimately was not able to combine these two APIs.
@RyanMsotheremail
@RyanMsotheremail 19 күн бұрын
I didn't really follow this challenge or the solution to it. I marked it complete and moved on to the next one. I do not think that the lesson really prepared me for this solution. I think I got the general concepts for working with an API using Authentication though so thanks for making that part clear.
@justhere-uu6mw
@justhere-uu6mw 19 күн бұрын
How does this work??i am genuinely interested
@dumbosSMP
@dumbosSMP 20 күн бұрын
it doesn't work in Pycharm, for DB =[