Discuss Scratch

marscratcher
Scratcher
100+ posts

Python!

This is a place where you can:
- Ask questions about python.
- Just talk about python.
- Or share your python scripts.

I myself have just started python, but I have yet to find a good place where I can get help with my programs or share things I have made, so I thought this would be a good opportunity.

Rules:
- Don't get off topic.
- When sharing a program, close it with code tags.

Suggestions for people that want to learn python:
- I suggest the book “Python For Kids” by Jason R. Briggs.
- I also suggest using the python processor Ninja.

Again, please feel free to ask questions, talk about what you are doing with python, or some programs you have made! Have fun!
rockinscratch
Scratcher
33 posts

Python!

I stared learning python at school. We made text-based adventure games, a bit like ZORK.
marscratcher
Scratcher
100+ posts

Python!

rockinscratch wrote:

I stared learning python at school. We made text-based adventure games, a bit like ZORK.
Cool! I have mostly been doing tkinter graphics to make games.
saofan123
Scratcher
47 posts

Python!

Woah you made python

Python is amazing man
marscratcher
Scratcher
100+ posts

Python!

saofan123 wrote:

Woah you made python

Python is amazing man
I know.
-HTTPS-
Scratcher
12 posts

Python!

I'd recommend PyCharm
marscratcher
Scratcher
100+ posts

Python!

-HTTPS- wrote:

I'd recommend PyCharm
What is it?
happymasksalesmen
Scratcher
4 posts

Python!

how do you install python on Mac OS X?
FloppyBop
Scratcher
100+ posts

Python!

Is it possible to make a 3D game in Python, like a first person shooter or Minecraft clone? Also, can you do it by downloading just one thing? That would be Python. But I am okay if you need Pygame to do it. Also I made a ridiculous program in Python that puts on word in front of another to make a funny phrase. I will share the scripts.

first_words =
second_words =
import random
import time
print('Type “Mix it, yollow!” Or you can just type “mix it”. or anything else you want to type')
while 1+1 == 2:
var = input(“>>>”)
fwn = random.randint(0, 14)
swn = random.randint(0, 14)
print(“Generating redonkulous phrase!”)
time.sleep(3)
print(first_words+“ ”+second_words)


Wait when I submitted this the stuff in the lists didn't show. I guess you will just have to add your own stuff.

Last edited by FloppyBop (June 21, 2017 20:20:14)

FloppyBop
Scratcher
100+ posts

Python!

saofan123 wrote:

Woah you made python

Python is amazing man
Dude he didn't make Python.
iwotastic
Scratcher
100+ posts

Python!

happymasksalesmen wrote:

how do you install python on Mac OS X?
It should come preinstalled. (At least it did for me on macOS 10.12.5)
saofan123
Scratcher
47 posts

Python!

FloppyBop wrote:

saofan123 wrote:

Woah you made python

Python is amazing man
Dude he didn't make Python.
then why did he ppost it in things im making and creating
bybb
Scratcher
1000+ posts

Python!

FloppyBop wrote:

Is it possible to make a 3D game in Python, like a first person shooter or Minecraft clone? Also, can you do it by downloading just one thing? That would be Python. But I am okay if you need Pygame to do it. Also I made a ridiculous program in Python that puts on word in front of another to make a funny phrase. I will share the scripts.

first_words =
second_words =
import random
import time
print('Type “Mix it, yollow!” Or you can just type “mix it”. or anything else you want to type')
while 1+1 == 2:
var = input(“>>>”)
fwn = random.randint(0, 14)
swn = random.randint(0, 14)
print(“Generating redonkulous phrase!”)
time.sleep(3)
print(first_words+“ ”+second_words)


Wait when I submitted this the stuff in the lists didn't show. I guess you will just have to add your own stuff.

Please put all code in [code] tags.
first_words = ["beard", "chicken", "yellow", "shirt", "shield", "Notch", "Bible", "computer", "purple", "spaghetti", "monster", "Psy", "Mojang", "Microsoft", "*,"]
second_words = ["hair", "sandwich", "pillow", "hole", "defence", "Persson", "book", "program", "guy", "meal", "dude", "is cool.", "is big.", "is big.", "cheese!"]
import random
import time
print('Type "Mix it, yollow!" Or you can just type "mix it".              or anything else you want to type')
while 1+1 == 2:
    var = input(">>>")
    fwn = random.randint(0, 14)
    swn = random.randint(0, 14)
    print("Generating redonkulous phrase!")
    time.sleep(3)
    print(first_words[fwn]+" "+second_words[swn])
iwotastic
Scratcher
100+ posts

Python!

saofan123 wrote:

FloppyBop wrote:

saofan123 wrote:

Woah you made python

Python is amazing man
Dude he didn't make Python.
then why did he ppost it in things im making and creating
He posted it here because he is learning how to use it (to make things).
bybb
Scratcher
1000+ posts

Python!

saofan123 wrote:

FloppyBop wrote:

saofan123 wrote:

Woah you made python

Python is amazing man
Dude he didn't make Python.
then why did he ppost it in things im making and creating
Because they're making Python programs, not Python itself.
marscratcher
Scratcher
100+ posts

Python!

iwotastic wrote:

happymasksalesmen wrote:

how do you install python on Mac OS X?
It should come preinstalled. (At least it did for me on macOS 10.12.5)
IDK, I suggest go here.
marscratcher
Scratcher
100+ posts

Python!

I made spike jump!
from tkinter import*
import time

class Ground:
def __init__(self, canvas):
self.canvas = canvas
self.id = canvas.create_rectangle(0, 0, 1200, 100, fill = 'black')
self.canvas.move(self.id, 0, 200)

class Player:
def __init__(self, canvas):
print('Start!')
self.canvas = canvas
self.id = canvas.create_rectangle(0, 0, 50, 50, fill = 'black')
self.canvas.move(self.id, 300, 150)
self.Yvel = 0
self.canvas.bind_all('<KeyPress-Up>', self.jump)
self.pos = self.canvas.coords(self.id)
self.alive = True
def draw(self):
self.canvas.move(self.id, 0, self.Yvel)
self.pos = self.canvas.coords(self.id)
if self.pos[3] < 200 :
self.Yvel = self.Yvel + 0.1
else:
self.Yvel = 0
self.canvas.move(self.id, 0, 200 - self.pos[3])
if self.pos[0] < spike.pos[4] and self.pos[0] > spike.pos[0] or self.pos[2] < spike.pos[4] and self.pos[2] > spike.pos[0]:
if self.pos[3] > spike.pos[3] :
self.alive = False
def jump(self, evt):
pos = self.canvas.coords(self.id)
if pos[3] == 200 :
self.Yvel = -5

class Spike:
def __init__(self, canvas):
self.canvas = canvas
self.id = canvas.create_polygon(0, 50, 20, 0, 40, 50)
self.canvas.move(self.id, 1160, 150)
self.speed = 2
self.pos = self.canvas.coords(self.id)
print()
print('Level:')
print(1)
def draw(self):
self.canvas.move(self.id, self.speed * -1, 0)
self.pos = self.canvas.coords(self.id)
if self.pos[0] < 0 :
self.canvas.move(self.id, 1160 +(0 - self.pos[0]), 0)
self.pos = self.canvas.coords(self.id)
if self.speed < 10 :
self.speed = self.speed + 1
print()
print('Level:')
print(self.speed - 1)

tk = Tk()
tk.title("Spike Jump")
tk.resizable(0, 0)
tk.wm_attributes("-topmost", 1)
canvas = Canvas(tk, width = 1200, height = 300, bd = 0, highlightthickness = 0)
canvas.pack()
tk.update()

player = Player(canvas)
spike = Spike(canvas)
ground = Ground(canvas)

while True:
player.draw()
spike.draw()
if not player.alive :
print()
print('Game Over!')
time.sleep(3)
break
tk.update_idletasks()
tk.update()
time.sleep(0.01)
-ShadowOfTheFuture-
Scratcher
1000+ posts

Python!

I use Python 2.

print "Hello, world!"

I have no idea why I decided to type that, of all the code I could've typed.
marscratcher
Scratcher
100+ posts

Python!

-ShadowOfTheFuture- wrote:

I use Python 2.

print "Hello, world!"

I have no idea why I decided to type that, of all the code I could've typed.
Dose'nt everybody type that code at some point?
-ShadowOfTheFuture-
Scratcher
1000+ posts

Python!

marscratcher wrote:

-ShadowOfTheFuture- wrote:

I use Python 2.

print "Hello, world!"

I have no idea why I decided to type that, of all the code I could've typed.
Dose'nt everybody type that code at some point?

Yes, but I typed it a year ago. I could've typed something else like

def fibonacci(how_many_numbers):
value_1 = 0
value_2 = 1
sum = 0
for i in range(how_many_numbers):
sum = value_1 + value_2
if value_1 < value_2:
value_1 = sum
else:
value_2 = sum

but instead I decided to type the most basic code possible. :P

I'm not even sure if that function works or not.

Powered by DjangoBB