0% found this document useful (0 votes)
4 views2 pages

Python Practise Question 1

The document contains a series of Python practice questions designed to help users learn basic programming concepts. It includes tasks such as reading and manipulating integers and floats, checking data types, performing arithmetic operations, and implementing conditional statements. Each question is accompanied by sample code for practical understanding.

Uploaded by

spotify0vj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python Practise Question 1

The document contains a series of Python practice questions designed to help users learn basic programming concepts. It includes tasks such as reading and manipulating integers and floats, checking data types, performing arithmetic operations, and implementing conditional statements. Each question is accompanied by sample code for practical understanding.

Uploaded by

spotify0vj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Practice Questions

1. Read an integer and a float and print their sum.

a = int(input("Enter integer: "))

b = float(input("Enter float: "))

print("Sum =", a + b)

2. Accept a string and display its data type.

s = input("Enter a string: ")

print(type(s))

3. Read a number and print its square and cube.

n = int(input("Enter number: "))

print("Square =", n*n)

print("Cube =", n*n*n)

4. Input name and age and display formatted output.

name = input("Enter name: ")

age = int(input("Enter age: "))

print(f"Hello {name}, you are {age} years old.")

5. Type conversion: string to integer.

s = input("Enter number: ")

n = int(s)

print(n + 10)
6. Check whether a number is positive, negative or zero.

n = int(input("Enter number: "))

if n > 0:

print("Positive")

elif n < 0:

print("Negative")

else:

print("Zero")

7. Check even or odd.

n = int(input("Enter number: "))

if n % 2 == 0:

print("Even")

else:

print("Odd")

8. Reverse a number.

n = int(input("Enter number: "))

rev = 0

while n > 0:

rev = rev * 10 + n % 10

n //= 10

print("Reversed =", rev)

You might also like