[Solved] How to input a player name?

In python 2, raw_input will return a string while input will return an evaluated string. Therefore input works fine for the numbers, since eval(‘2’) gives 2 (as an integer). However it does not work for the name, and hence eval(“John”) throws an error. I would recomment to use raw_input throughout your code. For the numbers … Read more

[Solved] How do i make a wall for breakout in pygame?

You can use bricks = pygame.sprite.Group() bricks.add( Bloque(0, 0) ) bricks.add( Bloque(100, 0) ) # etc. to keep bricks. And later you can use bricks.draw(screen) bricks.update() pygame.sprite.spritecollide(bola, bricks, dokill=True) Full working code import pygame import os import sys #— constants — (UPPER_CASE names) ANCHO = 768 LARGO = 480 DIRECCION = “imagenes” BLACK = ( … Read more

[Solved] array resize proportionally in python [closed]

If you really have a desire to do this with Python lists: SCALE_MULTIPLE = 2 # or any positive integer new_array = [] for orig_row in original: new_row = [] for orig_elem in orig_row: new_row.extend([orig_elem] * SCALE_MULTIPLE) new_array.extend(new_row[:] for _ in range(SCALE_MULTIPLE)) 3 solved array resize proportionally in python [closed]

[Solved] how to create ascii art in python [closed]

you can try the art package for python example: >>> from art import * >>> Art=text2art(“art”) # Return ascii text (default font) and default chr_ignore=True >>> print(Art) _ __ _ _ __ | |_ / _` || ‘__|| __| | (_| || | | |_ \__,_||_| \__| solved how to create ascii art in python … Read more

[Solved] I cant get the min or the max of a tuple

# omitted part try: price = list(input(“Enter the price of the sweet: “)) except ValueError: print(“Enter an integer”) Here you change str applying list to it. For example, read_value=”1234″ list(read_value) Out: [‘1’, ‘2’, ‘3’, ‘4’] # type: list of str To fix this issue, use int: # omitted part try: price = int(input(“Enter the price … Read more

[Solved] Rainbow Array on Python

Here is a basic example. rainbow = [‘Program Ended’, ‘Red’, ‘Orange’, ‘Yellow’, ‘Green’, ‘Blue’, ‘Indigo’] user_input = int(input(“Please select a number between 1 and 6: “)) if user_input > 0 and user_input < 7: print(rainbow[user_input]) else: print(“Program ended”) To capture a user’s input, you simply invoke: input() function. To access an array, you can do … Read more