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

Lesson For Programming 1

The document shows examples of using Python variables, operators, input, print functions and calculating salary based on input hours and rate. It also shows executing Python files from command prompt and getting user input.

Uploaded by

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

Lesson For Programming 1

The document shows examples of using Python variables, operators, input, print functions and calculating salary based on input hours and rate. It also shows executing Python files from command prompt and getting user input.

Uploaded by

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

C:\Users\Monnalou Farrelly>python

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit


(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a=25
>>> b=50
>>> print(a+b)
75
>>> name="Monna"
>>> print(name)
Monna
>>> print("welcome "+name)
welcome Monna
>>> student_name="Monna"
>>> math_grade=87
>>> science_grade=90
>>> english_grade=89
>>> final_grade=(math_grade+science_grade+english_grade)/3
>>> print("welcome "+student_name+" your average is "+str(final_grade))
welcome Monna your average is 88.66666666666667
>>> item="tumbler"
>>> cost=250
>>> order=10
>>> total_amount=order*cost

>>> print("You ordered "+ item + " total amount is "+str(total_amount))


You ordered tumbler total amount is 2500
>>> this is only to know variables
File "<stdin>", line 1
this is only to know variables
^
SyntaxError: invalid syntax
>>>
>>> exit()
===================================
C:\Users\Monnalou Farrelly>

name=input("Enter your name: ")


print(name)

============================
for directory execute

C:\Users\Monnalou Farrelly>cd c:/python_files

c:\python_files>python code_input.py
Enter your name monna
monna

c:\python_files>

========================

name=input("Enter your name ")


print(name)
email=input("Enter your email ")
print(email)
print("Welcome "+name+" your email is "+email)
========================
name=input("Enter your name: ")
hour=input("Enter your hour/s: ")
rate=input("Enter rate: ")
salary=float(hour)*float(rate)

print("Wecome "+name+" your salary is "+str(salary))

You might also like