Python Forum
Need help writing simple code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help writing simple code
#1
It doesn’t even have to work, my dad is a programmer and he uses python mostly. His birthday is coming up and I want to make him a shirt. I found this picture online and I thought it was funny but I don’t think it’s in python. I’m hoping someone can help me out. It should be super simple.
I’m sorry if this isn’t the place for this type of thing, but I couldn’t find anywhere else! I’d do it myself if I could, and I can’t ask my dad to help that would ruin the surprise lol.

[Image: mockup.jpg?composition=%7B%22artwork%22%...&width=480]
Reply
#2
looks like C, can you drink it?
Reply
#3
Maybe CoffeeScript on a Coffee cup Wink
Similar will look like this in Python:
coffee = Coffee()
if coffee.empty():
    coffee.refill()
else:
    coffee.drink()
If want more text something like this.
import time

coffee = Coffee()
if coffee.status() == coffee.empty():
    time.sleep(10)
    return coffee.refilled()
else:
    coffee.drink()
Reply
#4
(Mar-12-2018, 06:42 PM)snippsat Wrote: Maybe CoffeeScript on a Coffee cup Wink Similar will look like this in Python:
coffee = Coffee() if coffee.empty(): coffee.refill() else: coffee.drink() 
If want more text something like this.
import time coffee = Coffee() if coffee.status() == coffee.empty(): time.sleep(10) return coffee.refilled() else: coffee.drink()
Thank you so much!! I’m sure he’s going to love it! :)

(Mar-12-2018, 06:42 PM)snippsat Wrote: Maybe CoffeeScript on a Coffee cup Wink Similar will look like this in Python:
coffee = Coffee() if coffee.empty(): coffee.refill() else: coffee.drink() 
If want more text something like this.
import time coffee = Coffee() if coffee.status() == coffee.empty(): time.sleep(10) return coffee.refilled() else: coffee.drink()
What does time.sleep(10) mean?
Reply
#5
(Mar-12-2018, 10:26 PM)isashay Wrote: What does time.sleep(10) mean?
Time it can take to fill a coffee cup Wink
So if coffee.empty() it will take 10 second(sleep) then it will return coffee.refilled().
Reply
#6
The "//" means that the rest of the row is a comment (something for us a humans too read, not for the computer). To make a comment in python you use "#".
#This is a comment
Reply
#7
Yes the same in Python.
# i am a software developer
Reply
#8
(Mar-12-2018, 10:53 PM)snippsat Wrote:
(Mar-12-2018, 10:26 PM)isashay Wrote: What does time.sleep(10) mean?
Time it can take to fill a coffee cup Wink So if coffee.empty() it will take 10 second(sleep) then it will return coffee.refilled().
Oooh. I like that even better, thank you!!

(Mar-13-2018, 12:11 AM)PyBeginner Wrote: The "//" means that the rest of the row is a comment (something for us a humans too read, not for the computer). To make a comment in python you use "#".
#This is a comment
Thanks, i was wondering what that was lol
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with simple code JacobSkinner 1 314 Mar-18-2024, 08:08 PM
Last Post: deanhystad
  writing and running code in vscode without saving it akbarza 1 379 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  I have a code which is very simple but still I cannot detect what's wrong with it max22 1 476 Nov-07-2023, 04:32 PM
Last Post: snippsat
  help me simple code result min and max number abrahimusmaximus 2 902 Nov-12-2022, 07:52 AM
Last Post: buran
  Simple encoding code ebolisa 3 1,438 Jun-18-2022, 10:59 AM
Last Post: deanhystad
  How would you (as an python expert) make this code more efficient/simple coder_sw99 3 1,788 Feb-21-2022, 10:52 AM
Last Post: Gribouillis
  Simple code question about lambda and tuples JasPyt 7 3,299 Oct-04-2021, 05:18 PM
Last Post: snippsat
  My simple code don't works !! Nabi666 1 1,601 Sep-06-2021, 12:10 PM
Last Post: jefsummers
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 2,819 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  Plotting sum of data files using simple code Laplace12 3 3,036 Jun-16-2021, 02:06 PM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020