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

Python User Input and Operations Guide

The document outlines a Python program that collects a user's name and age, then prints a greeting. It also describes a second program that takes two numbers as input and calculates their sum, difference, product, and quotient. Additionally, it mentions practicing various operators in Python and performing operations on strings such as creation, concatenation, repetition, indexing, and slicing.

Uploaded by

appzz358
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)
7 views2 pages

Python User Input and Operations Guide

The document outlines a Python program that collects a user's name and age, then prints a greeting. It also describes a second program that takes two numbers as input and calculates their sum, difference, product, and quotient. Additionally, it mentions practicing various operators in Python and performing operations on strings such as creation, concatenation, repetition, indexing, and slicing.

Uploaded by

appzz358
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

1) Write a Python program that asks the user for their name and age, stores the information

in variables, and then prints the op.

name = input("Please enter your name: ")

age = input("Please enter your age: ")

print("Hello, my name is " + name + " and I am " + age + " years old.")

2)Write a program that takes two numbers as input from the user and calculates their sum,
difference, product, and quotient.

num1 = float(input("Enter the first number: "))

num2 = float(input("Enter the second number: "))

sum = num1 + num2

difference= num1 - num2

product = num1 * num2

quotient = num1 / num2

print("Sum:", sum)

print("Difference:", difference)

print("Product:", product)

print("Quotient:", quotient)

3) practice the programs with different type of operatiors in python


4) operations in string

a) creating a string

b)concatenation

C) repetition

d)indexing and accessing characters

e) Slicing

You might also like