Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/feed-rss2.php on line 8
‘#mastery28’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 26 Nov 2015 05:42:38 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ Mastery28 & Mastery29 https://kenscourses.com/tc101fall2015/2015/mastery28-mastery29-2/ Thu, 26 Nov 2015 05:42:38 +0000 http://finntec.wordpress.com/?p=98 Those are the masteries about

  • User input (text based) in Python (basic)
  • Validated user input in Python

 

You can find my video here:

]]>
https://creativecommons.org/licenses/by/4.0/
mastery 28 and 29 https://kenscourses.com/tc101fall2015/2015/mastery-28-and-29/ Thu, 26 Nov 2015 04:06:58 +0000 http://ilkapython.wordpress.com/?p=172

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery28 https://kenscourses.com/tc101fall2015/2015/mastery28-6/ Thu, 26 Nov 2015 02:54:11 +0000 http://jsphsalazar.wordpress.com/?p=152 ]]> Python has the ability to receive input coming from the user.

I’m talking about input function. When this function is called, the program stops and waits for the user to type something and the program continues when the user press return or enter.

After the input() function, Python received the text from the user and then assign the value to an variable text, after that, if the user prints the variable text, the user could see the text that wrote before.

Here’s an example:

1111

That’s basically the way it is.

 

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery28 & Mastery29 https://kenscourses.com/tc101fall2015/2015/mastery28-mastery29/ Thu, 26 Nov 2015 01:22:16 +0000 http://5nbppkkyj.wordpress.com/?p=195 ]]> User input (text based) in Python (basic) and Validated user input in Python

One way to have data in your code is to get it from external sources such as databases, another computer, the Internet, etc. The options are endless(sort of). Depending on what your code is about you will find that user input is quite valuable if you know what to do with it, we shall see more about this later on. First, we need to see how to get it.

Python makes this super easy for you because it has a built-in function which is unsurprisingly called input.

To declare an input you just add a parenthesis and type your prompt. In the example below I ask for someone’s age or you can get more complex data by creating lists or dictionaries with the input.

n = input(“Please enter your age: “)

The computer kind of replaces “Please enter your name:” with whatever the user writes, which is a prompt string. And when the function is evaluated the input is shown. Remember that whatever the user types, even if it is a number or a character, will ultimately be a string. If you want to use it in any other way then you would use other functions such float or int to modify it.

So in the code above, the variable n is replaced by whatever the user inputs, according to my example if I were to use my short program n will become my age as a string. The next piece of code shows you how to convert it into an integer using the int function.

n = input(“Please enter your age: “)

age = int(n)

I simply created a new variable called age and the value of my variable is mainly the user input but the function int before the name of the variable changes my age as a string intomy age as an integer. Allowing me to work with it.

So what happens if the user input does not match what you’re asking for? You validate it using =.

n = input(“Please enter your age: “)

if n == int:

print(“You look younger!”)

else:

print(“Not a number!”)

Conditionals are useful for this. My code above validates their input by asking whether n is an integer if it is not it prints “not a number” and if it is an integer it prints a very fake compliment.

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 28 https://kenscourses.com/tc101fall2015/2015/mastery-28/ Thu, 26 Nov 2015 01:00:40 +0000 http://octavioirg.wordpress.com/?p=253 ]]> Reading and writing on files.

This is a very cool tool to use with c++. The first time I used this I was shocked. How can this order work?! I mean, suddenly this type of assgiments have created in me some sort of extreme curiosity about what’s behind a computer. How does this computer I’m writting on works? It’s amazing. How ever, the point here is the mastery so let’s continue.

 

To read a file, and write on a file or do anything to a file you need to include a library called fstream. You know use the familiar “<>” symbols and the #include at the begining of your code.

]]>
https://creativecommons.org/licenses/by/4.0/
Input (user input) / Validate Input https://kenscourses.com/tc101fall2015/2015/input-user-input-validate-input/ Thu, 26 Nov 2015 00:09:00 +0000 http://asimplemaniseepythonipresslike.wordpress.com/?p=360 ]]> Sometimes we need the feedback from the user and this is how we made by input(), if you don’t know how this is done please check the video below 😀 and learn how to validate what the users typed!!!

Here’s the video:

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 28 & 30 https://kenscourses.com/tc101fall2015/2015/mastery-28-30/ Tue, 24 Nov 2015 02:52:21 +0000 http://davidg2897.wordpress.com/?p=298 ]]> Mastery 28 – User input (text based) in Python (basic)

Here’s basically any WSQ we’ve done, in most of them user input is needed.

Capture

Mastery 30 – Reading and writing of files in Python

Here’s an example code I made to demonstrate I know how to write and read files in Python.

Capture

]]>
https://creativecommons.org/licenses/by/4.0/
Interaction with Files #Mastery28 https://kenscourses.com/tc101fall2015/2015/interaction-with-files-mastery28/ Tue, 24 Nov 2015 00:32:33 +0000 https://interestingstuff.withknown.com/2015/interaction-with-files-mastery28

This Mastery consisted of writing and extracting information from files.

Here’s my video explaining the concept:

http://youtu.be/CIMHpCOYHKs?hd=1

]]>
https://creativecommons.org/licenses/by/4.0/
#mastery28 https://kenscourses.com/tc101fall2015/2015/mastery28-5/ Thu, 05 Nov 2015 01:33:04 +0000 http://pololarinette.wordpress.com/?p=115 ]]> Hey today we are going to learn how to create and use user input in Pythons 3 :

  1. creating and use user input

#Mastery28

]]>
https://creativecommons.org/licenses/by/4.0/
Masteries 7 & 28 https://kenscourses.com/tc101fall2015/2015/masteries-7-28/ Sun, 25 Oct 2015 04:29:17 +0000 https://carminaperezguerrero.wordpress.com/?p=94 Use of comments in Python

User input (text based) in Python

]]>
https://creativecommons.org/licenses/by/4.0/