Spelare 1 matar in sitt namn
**Extra, Spelare 2 kan mata in sitt namn, annars är spelare 2 dator**
**Extra du kan välja en klass, krigare, helare, tjuv, vad har det för effekt på spelet?**
Initiera spelare 1 liv med värdet 10
Initiera spelare 2 liv med värdet 10
Intiera spela med värdet True
Initiera runda med värdet 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import sys | |
import winsound | |
def loading_bar(): | |
for i in range(101): | |
time.sleep(0.01) | |
bar = set_color("green") + "#" * (i // 2) + set_color("reset") | |
sys.stdout.write(f"\rLoading... [{bar:<59}] {i}%") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import datetime | |
import os | |
import json | |
def input_int(text): | |
""" | |
Prompts the user for an integer input and returns the integer. | |
""" | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql from 'mysql2' | |
const pool = mysql.createPool({ | |
connectionLimit: 10, | |
waitForConnections: true, | |
queueLimit: 0, | |
charset: 'utf8mb4', | |
host: process.env.DATABASE_HOST, | |
user: process.env.DATABASE_USERNAME, | |
port: process.env.DATABASE_PORT, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def input_int(text): | |
while True: | |
try: | |
return int(input(text)) | |
except: | |
print("Felaktig inmatning, skriv ett heltal.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Du har två variabler med ett innehåll | |
# Vi summerar innehållet i en ny variabel | |
# Ge variablerna begripliga namn och förklara programmets funktion | |
arglf = "4" | |
glorf = "6" | |
plortig = arglf + glorf | |
print("Aajgkdf lwej: ", plortig) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.thepythoncode.com/article/convert-text-to-speech-in-python | |
#https://gtts.readthedocs.io/en/latest/ | |
# pip3 install gTTS pyttsx3 playsound | |
from playsound import playsound | |
import gtts | |
msg = "TEXTMEDDELANDE!" | |
text = msg * 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('../app'); | |
const supertest = require('supertest'); | |
const session = require('supertest-session'); | |
const pool = require('../utils/database'); | |
const bcrypt = require('bcrypt'); | |
const usersTable = process.env.DATABASE_USERSTABLE; | |
const { faker } = require('@faker-js/faker'); | |
const user1 = { | |
name: faker.name.firstName(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
from PIL import Image | |
size = (320, 240) | |
# https://pillow.readthedocs.io/en/stable/handbook/tutorial.html | |
# kör programmet med python3 thumb.py *.jpg | |
for infile in sys.argv[1:]: | |
outfile = os.path.splitext(infile)[0] + "_thumbnail.jpg" |
NewerOlder