🎉 Welcome to PyVerse! Start Learning Today

Intro to Python

Welcome! Hi, future coder!

Python is a friendly programming language that helps you make games, apps, and smart tools. In this lesson, you'll write your first code, learn how Python thinks, and try a mini activity. No experience needed—just curiosity.

What you'll learn today

  • How to run your first Python program
  • Printing messages
  • Comments (notes in your code)
  • Variables (how computers remember things)
  • Basic math
  • Getting input from the user
  • Simple decisions with if/else

1) Run your first Python program

You can try these examples in any online Python editor or in IDLE (comes with Python). Type this and run it:

print("Hello, PyVerse!")

What happens: print tells Python to show text on the screen.

2) Comments: notes for humans

Comments explain your code. Python ignores them.

# This is a comment. Python skips this line. print("Comments are cool!") # You can comment after code too

3) Variables: storing information

Variables give names to data so you can use them later.

name = "Ava" # a string (text) age = 14 # an integer (whole number) pi = 3.14 # a float (number with a decimal) print(name) print(age) print(pi)

You can mix variables with text using f-strings:

name = "Ava" age = 14 print(f"Hi {name}, next year you'll be {age + 1}.")

4) Math in Python

Python can do math like a calculator.

print(3 + 2) # addition -> 5 print(10 - 4) # subtraction -> 6 print(6 * 7) # multiplication -> 42 print(8 / 2) # division -> 4.0 (a float) print(9 // 2) # whole number division -> 4 print(9 % 2) # remainder (modulo) -> 1 print(2 ** 3) # power -> 8

5) Input: asking the user for data

input lets your program talk to people.

name = input("What is your name? ") age_text = input("How old are you? ") age = int(age_text) # turn text into a number print(f"Nice to meet you, {name}!") print(f"In 5 years you will be {age + 5}.")
Tip: input gives you text. Use int(...) when you need a number.

6) Decisions with if/else

Make your program react to conditions.

number = int(input("Pick a number: ")) if number % 2 == 0: print("That number is even!") else: print("That number is odd!")

Mini Activity: Emoji Repeater

Goal: Ask the user for an emoji (or any short text) and a number, then repeat it that many times.

Steps:

  1. Ask for an emoji or word (like "⭐" or "Hi")
  2. Ask for a number (how many times to repeat)
  3. Print the result

Hints:

  • Use input to ask questions
  • Convert the number with int(...)
  • In Python, "text" * 3 repeats the text 3 times

Try it yourself first!

Example solution:

emoji = input("Enter an emoji or short word: ") times = int(input("How many times should I repeat it? ")) print(emoji * times)

Common quick fixes

  • If you see ValueError when using int(...), you probably typed a word instead of a number. Try again with a number.
  • Python cares about exact spelling and punctuation. Check quotes " " and parentheses ( ).

Summary

Today you learned how to:

  • print messages
  • write comments
  • store data in variables
  • do basic math
  • get user input
  • make simple decisions with if/else

Keep experimenting! Change the numbers, messages, and conditions to see what happens. Every tiny program you write builds your Python superpowers.

Loading quizzes...