ICP 1 - VineethaG/Python_CS5590 GitHub Wiki

ICP 1

Program 1: To print the version

Use import sys

print(sys.version)

Program 2a.Take the user first name and last name and then print it in reverse order

Take First Name & Last Name

firstname=input("Enter First Name:")
lastname=input("Enter Last Name:")

To print the name reverse in reverse order:

print(Name[::-1])

Program 2b.To take two numbers from user and find their quotient and remainder. Print it

Take number 1 and number 2 as inputs from user

Num1=int(input("Enter Number 1:"))
Num2=int(input("Enter Number 2:"))
Calculate quotient & remainder
quotient=Num1//Num2
remainder=Num1%Num2

Program 3.Write a python program toThis is a number guess exercise. First pick a random digit via program i.e. 0,1,2,3,4,5,6,7,8,9Ask the user to guess the digit randomly picked by your program. Then print whether the number guess by the user is exactly matched or below the random number or above the random number. Also, your program should explain the rules of this number guess game to the user.

Use import random

To guess the random number in range 0-9: random.randint(0,9)

Take the Guess Number from user: GuessNum = int(input("Guess the Number:"))

if GuessNum>x:
    print("Number is Greater")
elif GuessNum<x:
    print("Number is Less")
else:
    print("Number is PERFECT!!")
    break

If Guess number is equal to random number then it prints "Number is PERFECT!!"

⚠️ **GitHub.com Fallback** ⚠️