Back
Close

533 Week 6

aguyader
353 views

Welcome!

Python can print message to use screen using a print() command

Now you make up a message:

The message can be personalized by means of a variable holding the name of the person.

Python can gather input from the user as well. Although I can't get it to work here, it would look just like this:

print("Enter your name:")

x = input()

print("Hello, " + x)

you can try it here: https://www.w3schools.com/python/ref_func_input.asp

Python program to print odd Numbers in given range

When you see the % symbol, you may think "percent". But in Python, as well as most other programming languages, it means something different.

The % symbol in Python is called the Modulo Operator. It returns the remainder of dividing the left hand operand by right hand operand. It's used to get the remainder of a division problem.

Also, != means not equal to.

#Now change the code so that it prints even numbers in a given range

Python program to print EVEN Numbers in given range

May have got you there.... The == operator compares the value or equality of two objects. This means you should use the equality operators == and !=, when comparing objects - which is technially what we are doing here.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants