Question

USE Python 1. Assign value 555 to the variable x, write code to square the variable...

USE Python

1. Assign value 555 to the variable x, write code to square the variable x and print out the result.

2. Given a string x, write a program to check if its first character is the same as its last character. If yes, the code should output "True" .

3. We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1. Assign value 555 to the variable x, write code to square the variable x and print out the result.
x = 555
x = x * x
print(x)

2. Given a string x, write a program to check if its first character is the same as its last character. If yes, the code should output "True" .
if(x[0]==x[-1]):
    print("True")

3. We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').
print(x+y)

Add a comment
Know the answer?
Add Answer to:
USE Python 1. Assign value 555 to the variable x, write code to square the variable...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT