Python Day 1

Barbara Streisand
Release: 2025-01-02 19:38:42
Original
941 people have browsed it

Python Day 1

'''Sample Program to get 2 Number inputs '''
Num = input('Enter any Number :')
Num1 = input('Enter any Number :')
Total = Num Num1 #-- --- Concatenates the values
print(Total)
print('Sum :',int(Num) int(Num1))
print('Difference : ',int(Num) - int(Num1))
print('Multiplication : ',int(Num) * int(Num1))
print('Division : ',int(Num) / int(Num1))
print('Modulus : ',int(Num) % int(Num1))

To run python file:

  1. Navigate to the file path in Terminal using cd 'Path'
  2. Run python3 'File Name.py'
  • Python processess every input received from the user as String. To perform any operations on the input , we need to typecast the input to desired datatype as above example.

The above is the detailed content of Python Day 1. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template