These are my answers for the challenges on Python.
Print Hello World.
my_string = "Hello, World!"
print(my_string)
-
The first line contains the sum of the two numbers.
-
The second line contains the difference of the two numbers (first - second).
-
The third line contains the product of the two numbers.
print(a + b)
print(a - b)
print(a * b)
The first line should contain the result of integer division, //.
The second line should contain the result of float division, /.
print(a // b)
print(a / b)
Given an integer, perform the following conditional actions:
If is odd, print Weird
If is even and in the inclusive range of to, print Not Weird
If is even and in the inclusive range of to, print Weird
If is even and greater than , print Not Weird
if n % 2 == 1:
print("Weird")
elif 2 <= n <= 5:
print("Not Weird")
elif 6 <= n <= 20:
print("Weird")
elif n > 20:
print("Not Weird")
a = int(input()) b = int(input()) m = int(input())
print(a**b) print(pow(a,b,m))