Re: Was: Dynamic Data type assignment

2020-01-30 Thread Dan Sommers
On Thu, 30 Jan 2020 20:40:50 +1300 DL Neil via Python-list wrote: > Why do we have [argparse] at the cmdLN and yet not have something > similar for input? Because argparse works on input, too? Many examples on https://docs.python.org/3/library/argparse.html¹ explicitly pass a list of strings to

Was: Dynamic Data type assignment

2020-01-29 Thread DL Neil via Python-list
Further thoughts on the OP's point:- On 29/01/20 4:51 PM, sushma ms wrote: ... But why can't we make output of input also dynamic data assignment. ... when i'm assigning value dynamically and when we comparing in "if" loop it is throwing compiler error. It should not throw error

Re: [docs] Dynamic Data type assignment

2020-01-28 Thread DL Neil via Python-list
On 29/01/20 4:51 PM, sushma ms wrote: Thanks a lot. But why can't we make output of input also dynamic data assignment. 1 please don't 'top post': the normal sequence of a conversation is question THEN answer! 2 ambiguity! It is not possible for the input() mechanism to tell whether you la

Re: [docs] Dynamic Data type assignment

2020-01-28 Thread sushma ms
Thanks a lot. But why can't we make output of input also dynamic data assignment. Thanks & Regards, Sushma MS On Tue, Jan 28, 2020, 9:54 PM Mariatta wrote: > input() returns a string. If you want it to be treated as an int you need > to cast it, example: > > num =int(input ("Enter number")) >

Re: Dynamic Data type assignment

2020-01-28 Thread Rhodri James
On 28/01/2020 12:03, sushma ms wrote: Hi Please find below example and the compiler error, when i'm assigning value dynamically and when we comparing in "if" loop it is throwing compiler error. It should not throw error It absolutely should throw an error. it should assign and act as int wh

Re: [docs] Dynamic Data type assignment

2020-01-28 Thread Mariatta
input() returns a string. If you want it to be treated as an int you need to cast it, example: num =int(input ("Enter number")) On Tue, Jan 28, 2020, 5:13 AM sushma ms wrote: > Hi > > Please find below example and the compiler error, > > when i'm assigning value dynamically and when we comparin

Dynamic Data type assignment

2020-01-28 Thread sushma ms
Hi Please find below example and the compiler error, when i'm assigning value dynamically and when we comparing in "if" loop it is throwing compiler error. It should not throw error it should assign and act as int why it is thinking as string. *Code Snippet:* print("Hello World") num = input("E