Thursday, November 19, 2020

Input and output in python



To print particular text on the screen we use print() function.

Example:

>>> print("hello world")

hello world

>>> print("hello\nworld")

hello

world

>>> 12

12

>>> 12+13

25

To get input we use input function.

>>> name=input("Enter your name")

Enter your nameMuthu karthikeyan

>>> name

'Muthu karthikeyan'

>>> 

I  think above codings or self explanatory.

A simple program for creating new brand name.

print("Welcome to our brand name generator")

city=input("Enter your city name")

pet=input("Enter your pet name")

print("your brand name is", city, pet)

 

output:

================== RESTART: C:/Users/Muthu/Documents/brand.py ==================

Welcome to our brand name generator

Enter your city nameMadurai

Enter your pet namestella

your brand name is Madurai stella

Thank you we shall meet tomorrow.

Muthu karthikeyan,Madurai, Tamilnad, India.

contact:91 9629329142.

 

 

No comments:

Post a Comment