Skip to content

Instantly share code, notes, and snippets.

View ROBOMASTER-S1's full-sized avatar
:octocat:
Computer Science & Python Programming Examples

Welcome To My Virtual Computer Science Research Laboratory ROBOMASTER-S1

:octocat:
Computer Science & Python Programming Examples
View GitHub Profile
@ROBOMASTER-S1
ROBOMASTER-S1 / Class with Return.py
Last active March 6, 2023 18:12
Class with Return Python Program Example: Created by Joseph C. Richardson
# Created by Joseph C. Richardson, GitHub.com
class My_Shapes:
def __init__(self,shape,sides):
self.shape=shape
self.sides=sides
def shape_sides(self):
return f'a {self.shape} has {self.sides}.\n'
@ROBOMASTER-S1
ROBOMASTER-S1 / Set Trix.py
Last active March 6, 2023 18:11
Set Trix Python Program Example: Created by Joseph C. Richardson
# Created by Joseph C. Richardson, GitHub.com
set1,set2=(
{'1','1','2','3','4','4','5','6','7','8','9','10'},
{'A','B','C','D','E','E','F','G','H','H','I','J'}
)
convert1,convert2=list(set1),list(set2)
convert1,convert2=sorted(convert1),sorted(convert2)
convert1.extend(convert2)
@ROBOMASTER-S1
ROBOMASTER-S1 / Convert Sets.py
Last active March 6, 2023 18:11
Convert Sets Python Program Example: Created by Joseph C. Richardson
# Create four packed sets, then convert them into packed and sorted, extended lists.
# Check to see if their values are all sorted and reversed. After that, reconvert the
# 'convert1' list back into a very long extended unsorted, unpacked set. Type and
# execute/run the program example below and see what happens.
# Created by Joseph C. Richardson, GitHub.com
set1,set2,set3,set4=(
{1,2,3,4,5,6,7,8,9,10,4,2,10},
{'1','1','2','3','4','4','5','6','7','8','9','10','20'},
@ROBOMASTER-S1
ROBOMASTER-S1 / Chr List Trix.py
Last active March 6, 2023 18:10
Chr List Trix Python Program Example: Created by Joseph C. Richardson
# Created by Joseph C. Richardson, GitHub.com
auto_int=[]
for i in range(48,58):
auto_int.append(chr(i))
print(auto_int)
print(f'\nYou have {len(auto_int)} items in your "auto_int" list.\n')
auto_abc_lower=[]
@ROBOMASTER-S1
ROBOMASTER-S1 / Led Function Loops.py
Last active March 6, 2023 18:09
Led Function Loops Python Program Example for the ROBOMASTER S1 robot: Created by Joseph C. Richardson
# Try these Robomaster S1 Led sets. Play around with the different functions and see what they do.
# Created by Joseph C. Richardson, GitHub.com
led=led_ctrl
define=rm_define
delay1,delay2,delay3,delay4=.1,.001,4,1
l1,l2=0,255
def start():
@ROBOMASTER-S1
ROBOMASTER-S1 / Robomaster S1 Music Notes.py
Last active March 6, 2023 18:08
Robomaster S1 Music Notes Python Program Example for the ROBOMASTER S1 robot: Created by Joseph C. Richardson
# Created by Joseph C. Richardson, GitHub.com
media_ctrl.play_sound(rm_define.media_sound_solmization_3B)
media_ctrl.play_sound(rm_define.media_sound_solmization_3A)
media_ctrl.play_sound(rm_define.media_sound_solmization_3G)
media_ctrl.play_sound(rm_define.media_sound_solmization_3F)
media_ctrl.play_sound(rm_define.media_sound_solmization_3E)
media_ctrl.play_sound(rm_define.media_sound_solmization_3D)
media_ctrl.play_sound(rm_define.media_sound_solmization_3C)
media_ctrl.play_sound(rm_define.media_sound_solmization_2B)
@ROBOMASTER-S1
ROBOMASTER-S1 / True and False.py
Last active March 6, 2023 18:07
True and False Python Program Example: Created by Joseph C. Richardson
# I learned this from a Python Youtuber, named Mosh. I only kept the start and stop parts of the program, so we can all
# learn how it works. It's pretty tricky looking. I'm still not always sure where to place my 'not' and such. lol
# Created by Joseph C. Richardson, GitHub.com
start=False
while True:
command=input('SPACECRAFT\n').lower().strip()
@ROBOMASTER-S1
ROBOMASTER-S1 / Set Conversion Example.py
Last active March 6, 2023 18:06
Set Conversion Python Program Example: Created by Joseph C. Richardson
# Here is one I created, which is also very useful to know. I hope you agree?-:)
# C adds up to 5555. I also created a set unpacking example, which has outer brackets
# that surround the actual packed sets, a and b. The a and the b get unionized and c
# is the SUM of the two converted sets, which now becomes a sorted, non-randomized
# non-duplicated listed printout instead.
# Created by Joseph C. Richardson, GitHub.com
a,b=(
{1,1,2,3,4,5,6,7,8,9,10},
@ROBOMASTER-S1
ROBOMASTER-S1 / The exec function.py
Last active March 6, 2023 18:04
The exec function Python Program Examples: Created by Joseph C. Richardson
# Sometimes if you are going to be using and reusing small bits of Python code
# over and over again, you might want to consider using the 'exec' function.
# The 'exec' function can be used in such examples as these examples below.
# Created by Joseph C. Richardson, GitHub.com
redundant_code='''
print("Python Programmer's Glossary Bible")
print('This block of code can be used and reused again and again.')
'''
@ROBOMASTER-S1
ROBOMASTER-S1 / OS Screen Colours.py
Last active March 6, 2023 18:03
OS Screen Colours Python Program Example: Created by Joseph C. Richardson
'''Save the Python file as 'OS screen colours'''
# There are OS screen colours, which colours text. These OS screen colour
# codes colour individual text characters. See program examples below.
# Created by Joseph C. Richardson, GitHub.com
import os
os.system('')