Pyviel

PyvielbetaWeb
Download

Your program

Ln 1, Col 1 Saved in this browser

Output


            
Nothing here yet.

Press the green Run button.

Problems

Ready when you are.

Quick help

Say something

print("Hello!")
# a comment

print shows something. Words in quotes are text. A line that begins with # is a note for people; Python skips it.

Keep a value

score = 0
score = score + 1
print(score)

A name, an = and a value keep it for later. The new value replaces the old one.

Make a choice

if score > 10:
    print("You made it.")
else:
    print("Keep going.")

The line ends with : and the lines below are pushed in by four spaces. They belong to it.

Do it again

for i in range(3):
    print("Again!")

n = 0
while n < 3:
    n = n + 1

for repeats a number of times. while keeps going while the question is true.

Ask a question

name = input("Your name? ")
age = int(input("Your age? "))
print("Hi", name)

input asks and gives back text. int(...) turns the text into a whole number.

Your own function

def greet(name):
    return "Hello " + name

print(greet("Ada"))

A function is a few lines with a name. return gives back the result.

A list

pets = ["cat", "dog"]
print(pets[0])
pets.append("owl")
print(len(pets))

The first item is number 0. append adds one at the end. len counts.

When something breaks

print(pirnt)

Pyviel says in a short sentence what happened and on which line. View full error shows the whole Python message.

Keyboard

Run Cmd/Ctrl + EnterSave Cmd/Ctrl + SFind Cmd/Ctrl + FStop EscComment Cmd/Ctrl + /Indent TabUnindent Shift + Tab