Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

#18 Python Tutorial for Beginners | User input in Python | Command Line Input

Автор: Telusko

Загружено: 2018-07-10

Просмотров: 1509143

Описание:

Check out our courses:

Java Spring Boot AI Live Course: https://go.telusko.com/JavaSpringBootAI
Coupon: TELUSKO20 (20% Discount)

AI Powered DevOps with AWS - Live Course :- https://go.telusko.com/AIDevOps-AWS
Coupon: TELUSKO20 (20% Discount)

Master Java Spring Development : https://go.telusko.com/masterjava
Coupon: TELUSKO20 (20% Discount)

For More Queries WhatsApp or Call on : +919008963671

website : https://courses.telusko.com/


Udemy Courses:

Spring: https://go.telusko.com/udemyteluskosp...
Java:- https://go.telusko.com/udemyteluskojava
Java Spring:- https://go.telusko.com/Udemyjavaspring
Java For Programmers:- https://go.telusko.com/javaProgrammers
Python : https://go.telusko.com/udemyteluskopy...
Git : https://go.telusko.com/udemyteluskogit
Docker : https://go.telusko.com/udemyteluskodo...

Instagram :   / navinreddyofficial  
Linkedin :   / navinreddy20  
TELUSKO Android App : https://go.telusko.com/TELUSKOAPP
TELUSKO IOS App : https://apple.co/3SsgmU2
Discord :   / discord  

In this lecture we are discussing about:
How to get user input
input function
printing input message
Type of input data
When to use index value
eval function
Passing values from command line
Argument line input

#1 How to get user input
-- Getting user input in Python is straightforward. You can use the input() function
to get input from the user. The input function takes a single argument, which is the
prompt message displayed to the user.

e.g
name = input("Please enter your name: ")
x=input("Enter first number: ");
y=input("Enter second number: ");
z=x+y;
print(z);


#2 input function
-- In Python, the input() function is used to accept user input from the command line or console.
name=input("Enter your name:");
print(name);
-- In this example, the input() function prompts the user to enter their name. Whatever the user types
in response is stored in the name variable.
-- Note that the input() function always returns a string, so if we want to use the user's input as a number,
we'll need to convert it using the appropriate type-casting function (e.g., int() for integers or float() for
floating-point numbers).

#3 Types of input data
-- The input() function always returns a string, regardless of what the user enters.
we may need to convert the input to a different data type if you want to perform calculations or other operations on it.

e.g
x=input("Enter first number: ");
a=int(x);
the input entered by the user is converted to an integer using the int() function in this example.

#4 when to use index value
-- If you want to get a single character from the user, we can use the input() function and index the result.
e.g
ch=input('enter a character: ');
print(ch[0])

ch=input('enter a character: ')[0];
print(ch);

#5 eval function
eval function
-- The eval() function in Python is used to evaluate an expression entered by the user as a string.
The eval() function returns the result of the expression as a value.

e.g
x=eval(input("Enter an expression: "));
typeOf = type(x);
print(typeOf);

#6
Passing values from command line
-- sys module provides access to any command-line arguments via the sys.argv list.
we can pass arguments to a Python script from the command line using the sys.argv list.
The first argument in the list is always the name of the script itself.

suppose we have a file named Mycode.py
in file we have written code
import sys # without this line you will get error
x=sys.argv[1];
y=sys.argv[2];
z=x+y;
print(z);

in command line we have to run this file
#python3 Mycode.py 9 5
0 1 2

Note: Mycode is count as 0th argument
9 is count as 1st argument
5 is count as 2nd argument

Github :- https://github.com/navinreddy20/Python-

Python for Beginners :- http://bit.ly/3JOLQhl

Editing Monitors :
https://amzn.to/2RfKWgL
https://amzn.to/2Q665JW
https://amzn.to/2OUP21a.

Java:- https://bit.ly/JavaUdemyTelusko
Spring:- https://bit.ly/SpringUdemyTelusko

More Learning :

Java :- https://bit.ly/3x6rr0N
Python :- https://bit.ly/3GRc7JX
Django :- https://bit.ly/3MmoJK6

JavaScript :- https://bit.ly/3tiAlHo
Node JS :- https://bit.ly/3GT4liq

Rest Api :-https://bit.ly/3MjhZwt
Servlet :- https://bit.ly/3Q7eA7k
Spring Framework :- https://bit.ly/3xi7buh
Design Patterns in Java :- https://bit.ly/3MocXiq
Docker :- https://bit.ly/3xjWzLA

Blockchain Tutorial :- https://bit.ly/3NSbOkc
Corda Tutorial:- https://bit.ly/3thbUKa
Hyperledger Fabric :- https://bit.ly/38RZCRB

NoSQL Tutorial :- https://bit.ly/3aJpRuc
Mysql Tutorial :- https://bit.ly/3thpr4L

Data Structures using Java :- https://bit.ly/3MuJa7S
Git Tutorial :- https://bit.ly/3NXyCPu

Donation:
PayPal Id : navinreddy20
https://www.telusko.com

#18 Python Tutorial for Beginners | User input in Python | Command Line Input

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

#19 Учебник Python для начинающих | Оператор If Elif Else в Python

#19 Учебник Python для начинающих | Оператор If Elif Else в Python

10 Important Python Concepts In 20 Minutes

10 Important Python Concepts In 20 Minutes

#16 Python Tutorial for Beginners | Working with PyCharm | Run | Debug | Trace | py file

#16 Python Tutorial for Beginners | Working with PyCharm | Run | Debug | Trace | py file

Making the Same Game in Python, Lua, and JavaScript

Making the Same Game in Python, Lua, and JavaScript

#20 Учебник Python для начинающих | Цикл While в Python

#20 Учебник Python для начинающих | Цикл While в Python

#32 Python Tutorial for Beginners | Functions in Python

#32 Python Tutorial for Beginners | Functions in Python

Animation vs. Coding

Animation vs. Coding

Весь синтаксис Python за 25 минут – Учебное пособие

Весь синтаксис Python за 25 минут – Учебное пособие

#21 Учебник Python для начинающих | Цикл For в Python

#21 Учебник Python для начинающих | Цикл For в Python

Python for Beginners (Full Course) | Programming Tutorial

Python for Beginners (Full Course) | Programming Tutorial

Making a Game in Python with No Experience

Making a Game in Python with No Experience

#63 Учебник Python для начинающих | Обработка исключений

#63 Учебник Python для начинающих | Обработка исключений

Python Object Oriented Programming Full Course 🐍

Python Object Oriented Programming Full Course 🐍

Словарь на Python

Словарь на Python

Python Generators Explained

Python Generators Explained

#26 Учебник Python для начинающих | Массивы в Python

#26 Учебник Python для начинающих | Массивы в Python

Прямая линия Путина. Что это было?

Прямая линия Путина. Что это было?

#14 Учебник Python для начинающих | Побитовые операторы Python

#14 Учебник Python для начинающих | Побитовые операторы Python

#22 Учебник Python для начинающих | Break Continue Pass в Python

#22 Учебник Python для начинающих | Break Continue Pass в Python

Появляется новый тип искусственного интеллекта, и он лучше, чем LLMS?

Появляется новый тип искусственного интеллекта, и он лучше, чем LLMS?

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]