💾 Archived View for gemini.ctrl-c.club › ~axeflayer › 2021-04-30-learningpython.gmi captured on 2022-04-29 at 12:41:33. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Learning Python as My First Language

Python is my first computer language, a while back I tried using scratch to make a game, but never really learned much from it. I'm not sure if scratch can even be counted as a language.

My Mom found out about some free courses provided by Cisco for Cybercecurity and Python. I took the Cybersecurity indroduction, which wasn't very hard. The Python course was much harder. That course took all the fun away from learning. It had a terible index, and if you stop halfway through and leave it takes a long time of clicking through lessons to find where you left off! When you forget some syntax its a pain to find the right section.

I ordered a book called Python Crash Course by Eric Matthes. I think it is easier to learn python from a book than an online course. One of the benifets of a book is that it can also be used as a quick reference. It has a Space invaders project inside made using Pygame. It also has a WebApp project.

Right now I'm still in the basics. Today I learned more about lists and managing them.

This is a something I made:

#Axeflayer April 30th 2021
dogs = ['husky', 'lab', 'poodle']#The first dog list

message = f"My dog is a {dogs[2].title()}"#A messgge about dog 2

print(message)#Prints The message

print(f"{dogs}\n")#Prints the list

dogs[2] = 'doodle'#Changes poodle to doodle in the list

message = f"My dog is now a {dogs[2].title()}"#prints our message again, but with doodle instaed of poodle

print(message)#Prints the changed message

print(f"{dogs}\n")#Prints the list

dogs.append('wolf')#adds wolf to the dogs list

print("Oh No! a rabid Wolf!")

print(f"{dogs}\n")#Prints the list

rabid = 'wolf'

dogs.remove(rabid)#Actually removing it

print("I shot the rabid wolf! See? this is the proof:")# Removed wolf message



print(dogs)#print dogs list

print('\nThe dogs are everywhere! I need to sort them alphabetically')

dogs.sort()

message = f"That's better, {dogs}\n"

print(message)

print(f"There are {len(dogs)} dogs!\n") # prints the number of dogs in my list

for dog in dogs:#loop thing that specifies a variable to A loop

	print(f"{dog.title()},  What a good dog!")
	print(f"Now go to bed {dog.title()}\n")

print("GoodNight Dogs")	

This is the output:

My dog is a Poodle
['husky', 'lab', 'poodle']

My dog is now a Doodle
['husky', 'lab', 'doodle']

Oh No! a rabid Wolf!
['husky', 'lab', 'doodle', 'wolf']

I shot the rabid wolf! See? this is the proof:
['husky', 'lab', 'doodle']

The dogs are everywhere! I need to sort them alphabetically
That's better, ['doodle', 'husky', 'lab']

There are 3 dogs!

Doodle,  What a good dog!
Now go to bed Doodle

Husky,  What a good dog!
Now go to bed Husky

Lab,  What a good dog!
Now go to bed Lab

GoodNight Dogs

I think after I learn the syntax from the book it will be easy to finish the python course. Learning the syntax is the hard part.

The project in the book that I'm looking foraward to is the Space Invaders clone, I'm going to theme mine after WWII. I'll call it Foreign Invasion (Maybe that's already used though). It might be fun to make a pet themed version of astrobotany eventually too. Are you suposed to leave white space between lines of code?