Discuss Scratch
- Discussion Forums
- » Things I'm Making and Creating
- » Python programming language
- Hai1-2-37
- Scratcher
39 posts
Python programming language
This is to the x and y positions using nested loops.This is for an assignment!
for x in range(4):
for y in range(3):
print(f'({x}, {y})')
Cool, looks like a two demantion matrix
- Hai1-2-37
- Scratcher
39 posts
Python programming language
What's demantion matrix?This is for an assignment!
for x in range(4):
for y in range(3):
print(f'({x}, {y})')
Cool, looks like a two demantion matrix
- Hai1-2-37
- Scratcher
39 posts
Python programming language
Newest piece of code for an exercise!
numbers =
max_numbers = numbers
for numbers in numbers:
if numbers > max_numbers:
max_numbers = numbers
print(max_numbers)
matrix = [
,
,
]
for row in matrix:
for item in row:
print(item)
numbers =
numbers.index(5)
numbers.sort()
print(numbers)
numbers =
max_numbers = numbers
for numbers in numbers:
if numbers > max_numbers:
max_numbers = numbers
print(max_numbers)
matrix = [
,
,
]
for row in matrix:
for item in row:
print(item)
numbers =
numbers.index(5)
numbers.sort()
print(numbers)
- spectre_specs
- Scratch Team
1000+ posts
Python programming language
This is a duplicate topic. I'll merge this thread into the earlier one.
Mod Squad
- Ricky-Jan_test
- Scratcher
21 posts
Python programming language
Newest piece of code for an exercise!
Really good! You learned how to use the list, but
you can try to use better variable names as “for numbers in numbers” is easily confused
- mumu245
- Scratcher
1000+ posts
Python programming language
(#1036)Because when you have a list of length 10, the indexes are 0 to 9, and range() is designed to match that. Use range(0, 10 + 1).But why isn't there a 10? Range is between 0 and 10.Do the numbers mean where it starts from and where it ends?
Correct! But be careful:for i in range(0, 10):“i” will only go from 0 to 9
You can also omit zero (I'm used to not omitting):for i in range(10):The output is the same
- kingKASEtheGREATalt
- Scratcher
100+ posts
Python programming language
i also made an image format in python:
https://github.com/c00lkase/cmi-image
https://github.com/c00lkase/cmi-image
- Hai1-2-37
- Scratcher
39 posts
Python programming language
Yeah, I'm sorry about that. I'll try to come up with better variable names next time. Thank you for telling me that!Newest piece of code for an exercise!
Really good! You learned how to use the list, but
you can try to use better variable names as “for numbers in numbers” is easily confused
- Hai1-2-37
- Scratcher
39 posts
Python programming language
I've learnt about dictionaries! Here is one of my code pieces:Newest piece of code for an exercise!
Really good! You learned how to use the list, but
you can try to use better variable names as “for numbers in numbers” is easily confused
coordinates = (1, 2, 3)
x, y, z = coordinates
print(f'{x}, {y}, {z}')
customer = {
“name”: “Thanh Nguyen”,
“age”: 46,
“is_verified”: True
}
customer = “Hai Nguyen”
print(customer.get(“name”))
phone_numbers_intergers = input(“Phone: ”)
number_translation = {
“1”: “one”,
“2”: “two”,
“3”: “three”,
“4”: “four”
}
output = “”
for each_digit in phone_numbers_intergers:
output += number_translation.get(each_digit, “!”) + “ ”
print(output)
- Ricky-Jan_test
- Scratcher
21 posts
Python programming language
coordinates = (1, 2, 3) x, y, z = coordinates print(f'{x}, {y}, {z}') customer = { "name": "Thanh Nguyen", "age": 46, "is_verified": True } customer["name"] = "Hai Nguyen" print(customer.get("name")) phone_numbers_intergers = input("Phone: ") number_translation = { "1": "one", "2": "two", "3": "three", "4": "four" } output = "" for each_digit in phone_numbers_intergers: output += number_translation.get(each_digit, "!") + " " print(output)
This is really good!
Last edited by Ricky-Jan_test (March 28, 2024 08:07:04)
- Hai1-2-37
- Scratcher
39 posts
Python programming language
Thank you!coordinates = (1, 2, 3) x, y, z = coordinates print(f'{x}, {y}, {z}') customer = { "name": "Thanh Nguyen", "age": 46, "is_verified": True } customer["name"] = "Hai Nguyen" print(customer.get("name")) phone_numbers_intergers = input("Phone: ") number_translation = { "1": "one", "2": "two", "3": "three", "4": "four" } output = "" for each_digit in phone_numbers_intergers: output += number_translation.get(each_digit, "!") + " " print(output)
This is really good!
- Hai1-2-37
- Scratcher
39 posts
Python programming language
My emoji converter!
message = input(“>”)
words = message.split(' ')
emojis = {
“”: “
message = input(“>”)
words = message.split(' ')
emojis = {
“”: “
- Hai1-2-37
- Scratcher
39 posts
Python programming language
Wait why isn't it showing the whole thing? My emoji converter!
message = input(“>”)
words = message.split(' ')
emojis = {
“”: "
message = input(“>”)
words = message.split(' ')
emojis = {
“”: “
- mybearworld
- Scratcher
1000+ posts
Python programming language
Emoji aren't supported by the Scratch forums.
Signatures are the only place where assets links still work.
- kkidslogin
- Scratcher
1000+ posts
Python programming language
(#1056)No, this is Scratch-wide. A few emojis are supported, for example: ☠️ ✝️ ™️ ☺️
Emoji aren't supported by the Scratch forums.
- mybearworld
- Scratcher
1000+ posts
Python programming language
I should've elaborated - in the forums, an emoji will cause everything after the emoji (and the emoji itself) to be removed. On the Scratch website, only the emoji get silently removed.(#1056)No, this is Scratch-wide. A few emojis are supported, for example: ☠️ ✝️ ™️ ☺️
Emoji aren't supported by the Scratch forums.
Signatures are the only place where assets links still work.
- Hai1-2-37
- Scratcher
39 posts
Python programming language
An assignment on inheritance!
class Mammal:
def walk(self):
print(“walk”)
print(“jump”)
print(“eat”)
class Dog(Mammal):
def bark(self):
print(“bark”)
dog1 = Dog()
dog1.walk()
dog1.bark()
class Mammal:
def walk(self):
print(“walk”)
print(“jump”)
print(“eat”)
class Dog(Mammal):
def bark(self):
print(“bark”)
dog1 = Dog()
dog1.walk()
dog1.bark()
- DifferentDance8
- Scratcher
1000+ posts
Python programming language
my entire website in pythonuhh you might want to get rid of that link as it contains a dizzy i host
Mod's Protogen Maker v2 released. I will update it when I will update it
- Discussion Forums
- » Things I'm Making and Creating
- » Python programming language