Close

Coding

Check out our informative posts on such important part of programming as coding

Prototype of a text game Part 2

Next we use a for — in loop, which I have before, if I remember correctly, you didn’t. A for — in loop runs as many iterations as elements in the object is placed after the keyword in. In our case, this is a list of actions. The function enumerate() is used to ensure that […]

Read More

Prototype of a text game Part 1

In the new issue of blog about programming, I’m getting a prototype created in the previous release. Last time we brought a text game lam-40 to the first working prototype, which, however, still far from the final version. At the end of the article, I outlined the main disadvantages of this prototype, and today we […]

Read More

Writing a game in Python Part 2

The biggest headache at first — it’s self when you refer to a function or feature class inside of this class, and the comparison operator == instead of = assignment operator beside the conditional operators. Probably about that, and about other you will forget, so watch out for that. By the way, note the key word […]

Read More

Writing a game in Python Part 1

In the new issue of blog about programming, I bring the game LAM-40 (we started writing it in the last issue) to an elementary prototype that already can be tested. Last time we figured out how to prepare your computer to work with python, and now can move on to writing games. In creating any […]

Read More

Loops, conditions and exceptions in Python Part 3

If the condition is false, the interpreter moves to the next unit in line, in our case — the string with the keyword else. This word tells the interpreter that if the condition in if is not executed, you should execute the code inside the else block:. In this block I put the two operations […]

Read More

Loops, conditions and exceptions in Python Part 2

Attention! Only that I brought not very literate code, or rather — not very code. Although the interpreter would accept it, the design that I used, rather typical for other languages, e.g., C (although, in my opinion, still not very elegant). In Python to specify how many times the loop should execute the statements within […]

Read More

Loops, conditions and exceptions in Python Part 1

For a start, something I will explain. The blog is called “I learn to program” and not “I teach program” — in other words, this is not a tutorial on programming. I’m no expert and don’t have the skills of the teacher, but because if you can take it upon themselves to teach someone, it […]

Read More

Classes and objects in Python Part 2

First we import the random library (you may need to install it), from which we need the function choice () that allows you to select a random object from the list. Import with keyword import and the names of libraries are usually always held at the beginning of the file. Create a list with greetings. […]

Read More

Classes and objects in Python Part 1

After a week break caused by WWDC, we’re back to Python. We finished work on a program that calculates the square of a given integer, so it’s time to undertake something more ambitious — for example, a text game that can help you to understand key concepts of object-oriented programming. If you are interested in […]

Read More

A text game in Python

In the new issue of blog about programming, I bring a text game LAM-40 to alpha version and is ready to start public beta testing. My imitation of the development cycle reached its climax a week ago. I’ve hit the deadline and had no time to prepare a version of lam-40, which was supposed to […]

Read More