533 Week 6

aguyader
594 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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.

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content