Foundations of Python

You are currently auditing this course.
2 / 134

Introduction to Programming and Python

Overview

As part of this session, we will learn the following:

  1. Why Learn Programming
  2. Computer Architecture - Hardware + Software
  3. Brief Peek Into Python
  4. Why Do People Use Python?
  5. What Can I Do with Python?
  6. Why python not R for Machine Learning?
  7. Launching Python
  8. Elements of Python: Reserved Words, Sentences, Paragraphs
  9. Writing a Simple Program
  10. Program Flow: Sequential, Conditional, Repeated Steps
  11. Variables, Expressions, and Statements
  12. User Input, Comments in Python

Recording of Session

Slides

Code Repository for the course on GitHub


No hints are availble for this assesment

Answer is not availble for this assesment

Please login to comment

417 Comments

facing error while opening the juyter notebook for python

  Upvote    Share

error 

  Upvote    Share

Hi Sumit,

Can you restart your jupyter server from the control panel and try again. You can refer to https://discuss.cloudxlab.com/t/im-having-problem-with-assessment-engine-how-should-i-fix/3734 for it.

  Upvote    Share

Hi I have the file myfile1.txt in Jupiter files folder.But it is showing as error file not found..Kindly clarify.

  Upvote    Share

Can you input the absoulte path of the file?

  Upvote    Share

Yes.But still getting the error.Now cant execute the output in my jupiter notebook

  Upvote    Share

May I know where to input the absolute path of the file?whether in the program (Jupiter notebook) or in the console?

  Upvote    Share

In Python, when you try to open a file using just the filename (like open('myfile.txt')), Python looks for that file in the current working directory — the folder where your Jupyter notebook is running from.

If the file isn't in the current working directory, Python will throw a FileNotFoundError.

How the path works in Python:

Relative Paths:
If you just give a filename (like myfile.txt), Python looks in the current working directory (the folder you're running the notebook from). You can find out what this folder is with:

import os
os.getcwd()  # This will give you the current working directory

Absolute Paths:
If you want to open a file that's not in the current directory, you can give an absolute path (like /Users/username/Documents/myfile.txt). This tells Python exactly where to look, no matter where the notebook is running from.

Relative Paths:
If the file is in a folder relative to where the notebook is, you can use a relative path. For example:

If the file is in a folder inside your current folder, you could do something like:

open('foldername/myfile.txt')

If it's one folder up, you can use .. to move up a level:

open('../myfile.txt')

Example:

Let's say your Jupyter notebook is in the folder ~/Documents/notebooks/, and you want to open a file in ~/Documents/data/. You would do something like:

open('../data/myfile.txt')

This tells Python to go up one folder (..) and then look for the file in the data folder.

  Upvote    Share

Hi..I have tried.But still cant execute.Also whenever I tried to get the input data the kernel becomes busy and the code got struck and not passing.Kindly help..

  Upvote    Share

Hi Gowri,

Can you share screenshot of the issue so we can understand it better?

  Upvote    Share

Hi when i use the command to use Python in Web Console.It is showing error:

[roopamambekar149820@cxln4 ~]$ export PATH=/usr/local/anaconda/bin:$PATH

[roopamambekar149820@cxln4 ~]$ source activate py36

Could not find conda environment: py36

You can list all discoverable environments with `conda info --envs`.

  Upvote    Share

You can diretly open python shell by using the below command:

python3

 

  Upvote    Share

Dear Team, similar to how we could access the files in the Linux course via WSL on my laptop, is there anyway to access CloudXLab's Jupyter notebook via my computer's cmd? 

  Upvote    Share

 

Here's what I tried to do but it didn't work. 

  Upvote    Share

While it's possible to set up a virtual environment and install the Jupyter kernel in the Cloudxlab console, we highly recommend utilizing our interface for its user-friendly features and seamless integration. Our interface is designed to provide an optimal user experience, ensuring efficiency and ease of use.

 1  Upvote    Share

Hey I have a question about why x = 1 + 2 ** 3 / 4 * 5
print (x) resolves to x as 11

According to the order of operations follwoing the PEMDAS rule, after solving for parantheses and exponents is followed by solfing multiplication and then division, but in this case after calculating 2**3, the next operation should be 4*5, why is 8/4 prioritized?


  Upvote    Share

You're correct that PEMDAS (or BODMAS) dictates the order of operations in math and programming, but it's essential to remember that multiplication and division have equal precedence, as do addition and subtraction. When operations have the same precedence, they're evaluated from left to right.

Here's how the expression x = 1 + 2 ** 3 / 4 * 5 is evaluated step by step:

Exponentiation: 2 ** 3 is calculated first, resulting in 8.

Division: 8 / 4 is performed next, as division has the same precedence as multiplication and it's encountered first from left to right. This gives 2.

Multiplication: 2 * 5 is calculated, resulting in 10.

Addition: Finally, 1 + 10 is performed, resulting in 11.

Therefore, the correct value of x is indeed 11.

To make the order more explicit, you can use parentheses:

x = 1 + ((2 ** 3) / 4) * 5

This clarifies that the division should be performed before the multiplication, leading to the same result of 11.

  Upvote    Share

Thx Shubh. that was a much needed refresher I got as I did come across this slide dring the quiz

  Upvote    Share

while trying to run the code
n = 5
while n>0:
    print('n')
    n = n-1
    print('Blastoff')

 

Output am getting is

n
Blastoff
n
Blastoff
n
Blastoff
n
Blastoff
n
Blastoff

 

Please correct me where am going wrong.

  Upvote    Share

What you are trying to achieve?

Could you please specify?

  Upvote    Share

If you are trying to achieve this

4 Blastoff
3 Blastoff
2 Blastoff
1 Blastoff
0 Blastoff

Then please remove {print('n')} from your code because the way you provided "n" is string.

Instead, Use this method,

n = 5
while n>0:
    n = n-1
    print(n,'Blastoff')

 

Now N is taken as integer and it will print with each iterations

  Upvote    Share

I got what i was looking for

n = 5
while n>0:
    print n
    n = n - 1
print('Blastoff')

O/P

5
4
3
2
1
Blastoff!
 1  Upvote    Share

can you please tell me exact wat to use console..which path need to export

  Upvote    Share

Hi Swapnil,

Can you please elaborate on your issue?

  Upvote    Share

As I go on the services tab and try to open web console, there's nothing but blank screen and a message that browser failed to open the page. I tried logging out and then logginf In again but couldn't open it.

  Upvote    Share

Hi Kanishk,

It is working fine from my end. Can you re-check?

Also check your network connection and proxies.

  Upvote    Share

If it is not resolved, then please share the screenshot of the browser window.

  Upvote    Share

 I can't see result of any program written after pressing SHIFT+ENTER.

Please suggest if there is anything missing.

Thanks.

  Upvote    Share

Hi,

You can try restarting the kernel. It will work fine then.

  Upvote    Share

as i open the web console, I am not able to enter the password. it stops responding after entering the username..

 

  Upvote    Share

Hello Shikha

It's working fine from my end. Can you please recheck?

  Upvote    Share

Hi,

Could you please help me understand why my program is not correctly executing?

  Upvote    Share

Hi,

Can you further ellaborate your issue.

  Upvote    Share

It is very important to a software engineer

  Upvote    Share

Great

 

 1  Upvote    Share

I am unable to activate python in console can some one guide me here.

  Upvote    Share

After exporting the path just type python3 and run it.

 1  Upvote    Share

why i cannot download the ppts shared above, i m a licenced user

  Upvote    Share

There is a pop-out button on top right corner. Use it to open ppt in new tab. From there you can download it.

 1  Upvote    Share

Thank you sir, but i am using LInux mint and it shows :

The page isn’t redirecting properly

An error occurred during a connection to docs.google.com.

    This problem can sometimes be caused by disabling or refusing to accept cookies.

ON windows , its getting downloaded properly. I want to download on linux, please help

  Upvote    Share

Hi Zainab,

It seems to be some issues with the cookies in your browser.

  Upvote    Share

similarly, anaconda is also not getting installed on my Linux mint , although i can download it on windows 10, can u help me in this?

  Upvote    Share

[sanasyed71219857131@cxln5 ~]$ ls
asad                         myfirstscript.sh.save    untitled.txt
cloudxlab_jupyter_notebooks  myfirstscript.sh.save.1  wc_results
devops                       mylink                   webserver
hello.out                    myproject                word_count_nice
hellopython.py               myslink                  word_count_results
myemptyfile                  orig_text                word_count_results_nice
myemptyfile.txt              orig_texty               wordcountscript.sh
myfirstfile                  proj                     xyz
myfirstfile_copy.txt         sana                     z
myfirstscript.sh             src
[sanasyed71219857131@cxln5 ~]$ python 3 hellopython.py
python: can't open file '3': [Errno 2] No such file or directory
[sanasyed71219857131@cxln5 ~]$

  Upvote    Share

Hello sir.....why cant python command run on unix console?..How to do it?

  Upvote    Share

It should be python3 and not python 3.

Please mind the space.

  Upvote    Share

SO many times i refrresh it still console does not open properly...some one plz help me

  Upvote    Share

Hi Ayushi,

I just checked your account. It seems to be working fine in Google Chrome. Could you try using Google Chrome and let us know if you still face issues?

 

  Upvote    Share

what is meant by literals??

  Upvote    Share

Hi,

literals are the values which will be assigned to varrioables.

For example, 

a = "This is apple"

b = 23.4

c = 98

Here, 

"This is apple", 23.4, 98 are literals, and a,b,c are variabls.

Thanks.

  Upvote    Share

thank you..

  Upvote    Share

what is work with this code? it is not executing

n = 5
while n > 0 :
    print(n)
    n = n-1
print('BOOOOOOM')

 1  Upvote    Share

Hi,

Please share a screenshot of your code and the error you are getting.

Thanks.

  Upvote    Share

now it is working, some issue with the lab. it happens random

  Upvote    Share

while trying to run sample example 2+3 , Shift + Enter doesn't work, below shreenshot

  Upvote    Share

Hi,

Could you please try the following steps:

1. Try to press the Run button instead of Shift+Enter and see if it works

2. Clear your browser cache and cookies, refresh the page and try again

3. Try a different browser

Let me know if you are still facing any issues.

Thanks.

  Upvote    Share

this works now after logout and login again. thanks.

  Upvote    Share

Hi,

I am facing th ebelow issue. Please help.

  Upvote    Share

Hi,

Please restart your server by following the instructions from the below link:

https://discuss.cloudxlab.com/t/im-having-problem-with-assessment-engine-how-should-i-fix/3734

Once done, please refresh the page and check if it is working fine.

Thanks.

  Upvote    Share

This comment has been removed.

Please check this weired behaviour , 30 min back i was able to run codes perfectly but now every execution went to halt state. don't know what to do.

even for this python course the console requires to be re-login each time otherwise it gives 404 error.

Please help.

  Upvote    Share

If the jupyter is idle for long it may not run the code. So, please reload the page and run it again.

You were getting 404 error on this page because the cloudxlab_jupyter_notebooks directory was deleted from your home directory. It should work properly now.

  Upvote    Share

Thanks Sandeep, 404 problem has been resolved for me. 

And for jupyter , i haven't faced the same problem yet. but that day ,i had tried refreshing ,even relogin and relogin by clearing the cache of my browser. 

But hopefully i have not faced  that problem again. so i am good thanks for the help.

  Upvote    Share

I am getting this eror 

>>> python3 firstProg.py
  File "<stdin>", line 1
    python3 firstProg.py
                    ^
SyntaxError: invalid syntax

  Upvote    Share

Hi,

First, enter the following line in command prompt:

export PATH=/usr/local/anaconda/bin:$PATH

Now just type the following to run your Python script:

python3 firstProg.py

Thanks.

  Upvote    Share

I think it would be better if you add classifications to the video. It would be easy to naviagate the topics being covered

 1  Upvote    Share

Hi,

Thanks for your feedback. We would consider it while updating our courseware.

Thanks.

  Upvote    Share

Jupyter notebook is not opening

404: Not Found

You are requesting a page that does not exist!

  Upvote    Share

Hi,

Do you still face the same issue?

 

  Upvote    Share

hy, yes, I'm still facing the same issue.

 

  Upvote    Share

getting error 404. pl help

404 : Not Found

You are requesting a page that does not exist!

 

  Upvote    Share

Hi, Can you please refresh and check it again?

  Upvote    Share

Hello, I am using the Lab username and password to sign into Jupyter but I am getting Invalid username or password, please help

 

Thank you

  Upvote    Share

Hello, I am trying to login to Jupyter what credentials do I use to login

 

  Upvote    Share

Hi,

You could use the Lab username and Lab password given on top of the Jupyter Notebook.

Thanks.

  Upvote    Share

Hello, i am using the lab login credentials but I am getting invalid username or password please help

 

  Upvote    Share

Hi,

We have resolved the issue from our end. Could you please recheck and let me know if it is working now?

Thanks.

  Upvote    Share

LOGIN DETAILS ARE NOT WORKING IN LAB?

 

  Upvote    Share

Hi,

I checked from my end, your login details are working fine. Could you please try to login once again, this time please type in your password instead of copy pasting it. Also, clear your browser cache and cookies before login in.

Let me know if it worked.

Thanks.

  Upvote    Share

Hi,

We have resolved the issue from our end. Please recheck and let me know if it is working now.

Thanks.

  Upvote    Share

Hi Team,

My Prog works with python <filename>, however as per video need to put python3.

Also, it seems Jupyter has python version of 2.7 instead of 3.

 

[anaflex4u6862@cxln4 ~]$ ls -ltr
total 8
drwxr-xr-x 3 anaflex4u6862 anaflex4u6862 4096 Feb 21 17:11 cloudxlab_jupyter_notebooks
-rw-r--r-- 1 anaflex4u6862 anaflex4u6862   20 Feb 21 17:13 firstProg.py
[anaflex4u6862@cxln4 ~]$ python firstProg.py
[20]
[anaflex4u6862@cxln4 ~]$ python
Python 2.7.5 (default, Apr  9 2019, 14:30:50)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

  Upvote    Share

Hi,

Please visit https://discuss.cloudxlab.com/t/python-3-in-lab/393/9?u=vagdevi_k to use python3 in webconsole.

Thanks.

  Upvote    Share

Thanks

  Upvote    Share

I seem to be doing something wrong:

 

[anaflex4u6862@cxln4 ~]$ export PATH=/usr/local/anaconda/bin:$PATH
[anaflex4u6862@cxln4 ~]$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> firstProg.py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'firstProg' is not defined

 

  Upvote    Share

Hi,

Try the following:

>>>python3 firstProg.py

Thanks.

  Upvote    Share
[anaflex4u6862@cxln4 ~]$ python3 firstProg.py
bash: python3: command not found
[anaflex4u6862@cxln4 ~]$ export PATH=/usr/local/anaconda/bin:$PATH
[anaflex4u6862@cxln4 ~]$ python3 firstProg.py
Traceback (most recent call last):
  File "firstProg.py", line 3, in <module>
    print[x]
TypeError: 'builtin_function_or_method' object is not subscriptable
[anaflex4u6862@cxln4 ~]$

Still not working

  Upvote    Share

Hi,

The print command in your program is incorrect.

Thanks.

  Upvote    Share

Also, to change kernel in jupyter notebook, you could use kernel option, and change it to python3.

  Upvote    Share

When I use console with command 'source activate py36'

it gives following error:

source activate py36

 

Please suggest

  Upvote    Share

Hi,

Please try the following command instead:

source activate root

Thanks.

  Upvote    Share

the lab which are using in the part 1 is just for inly knowledge or we have to make any assignments on that?

  Upvote    Share

Hi,

As you go along, you can see the instructions. Please follow the instructions and write your code on the lab appearing on the right-side. Then submit it to the assessment engine by clicking on the submit answer option below the instructions.

Thanks.

  Upvote    Share

But they to activate the lab it will be activate only for 7 days . if the course is not completed within 7 days how will complete my course

 

  Upvote    Share

Hi,

You can always subscribe to the lab for a minimal fee.

Thanks.

  Upvote    Share

My jupiter -python prompt dosent respond to any command.. Is there any cache or any setting i need to do to resolve this?

 

  Upvote    Share

Hi Chitra,

If you see python kernel is running this can you verify by seeing either star(*) in the left side of the jupyter notebook or by seeing black dot on the top right just after 'Python 3'.

You can shut down and then restart the Kernel. this can be done using the Kernel > shutdown and Kernel > Reconnect/Restart

Hope this help. Happy learning

  Upvote    Share

This comment has been removed.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-4972359bca69> in <module>
      1 x = 5
      2 if x < 10:
----> 3     print("Small")

TypeError: 'str' object is not callable
  Upvote    Share

Kindly suggest what should I do with the error received above, I am not able to solve it.

Thanks

 

  Upvote    Share

Hi,

Please attach the screenshot of your code.

Thanks.

  Upvote    Share

I refreshed the page once, and it was sorted.

Thank you for the help.

  Upvote    Share

hi

why notebook is unresponsive to me?

can you please help me in this

  Upvote    Share

FYI

  Upvote    Share

Hi,

Please refresh the page once and let me know if you are still facing this issue.

Thanks.

  Upvote    Share

I have file hellopython.py and simpleexp.py in my home directory

though why I am getting error for commands % run simpleexp.py and python3 simpleexp.py

 

code in the file is

x = 58
if x < 10:
    print('smaller')
if x > 20:
    print('bigger')
print('finish')

  Upvote    Share

Hi,

It is mandatory to complete all the Python related assessments/codes on the default Jupyter notebook provided on the right side of the split screen.

Thanks.

  Upvote    Share

yes I am doing the same assignment shown in the video, so facing above issue

can you please help me in that?

  Upvote    Share

Hi,

That is not an assignment, it is a part of the tutorial. The assignments would have specific instructions and you are required to write the code on the default Jupyter notebook on the right side. Instead of creating a file, simply write the code on the Jupyter notebook and evaluate. However, if you still want to run it using the command line, try python filename instead of python3 filename.

Thanks.

  Upvote    Share

This comment has been removed.

Dear,

When i use console, everytime my python version goes to back to "2.7.5".. is it expected behavior ?  Do i need to run the below command every time?

export PATH=/usr/local/anaconda/bin:$PATH

  Upvote    Share

Hi,

Yes, that's correct. However, you do not need to access Python from the console. It is mandatory to complete all the assessments on the default Jupyter notebook given on the right side of the split screen.

Thanks.

  Upvote    Share

Sir,

I cannot briing back the side by side console. I tried to open it though the files section but it always is opening in a new window. Whenver I click on Notebook the interactive shell shows u and I cannot get our of it. Please HELP.

  Upvote    Share

Hi,

The notebook on the right side of the split screen cannot be replaced. They are default notebooks which are detected by the assessment engine. Would recommend you to work on them instead of any other notebook, otherwise the assessment engine will not be able to detect your codes.

Thanks.

  Upvote    Share

Sir,

I understand what you have said. Actually I cannot access the notebook on the right side of the split screen. It has gone dark probably it's gone to the interactive shel mode. Please help me restore the default version of the split screen window.

  Upvote    Share

I got it resetted to the default version. Thank you!

  Upvote    Share

Hi, i cannot access the jupyter on right hand side console. I can login but its shows no terminal running, no notebooks running

  Upvote    Share

Hi,

Please attach the screenshot of the issue you are facing.

Thanks.

  Upvote    Share

it seems to working fine now, after i restarted my computer

  Upvote    Share

What does these cross mean?does they mean I have not completed those?

 

  Upvote    Share

Hi,

Yes, you're right.

Thanks.

  Upvote    Share

I can't understand why this syntax error please explain...

 

  Upvote    Share

Hi Shubham,

You're trying to run python file in python prompt, it is supposed to be run in unix shell, also in jupyter the file is supposed to be ".ipynb" to able to execute using it's kernel.

python filename.py

 

  Upvote    Share

sir what is command in console in window ,when we use text file in which we write addtion code?how can we access that file in windows in console directly? because it shows command not found again and again. the command that you told for windows that is not working in console sir.

  Upvote    Share

Hi,

You need to perform these commands in the lab only. They will not work on Windows since these are Linux commands.

Thanks.

  Upvote    Share

sir i am getting internal server error in python

  Upvote    Share

Hi,
Sorry for the inconvenience, we have fixed this, Lab is working fine now.

Thanks.

  Upvote    Share

sir when we do start coding

  Upvote    Share

Hi,

As you move forward in this course, you will start with the coding exercises.

Thanks.

  Upvote    Share

Hi, Im getting the following Syntax error.

  Upvote    Share

Hi,

You will have to put "==" in order to compare if left and right operands are equal to each other. "=" indicates assigning right operand to left operand.

Thanks.

 1  Upvote    Share

This comment has been removed.

x=5
if x < 10
print ["smaller"]
if x > 20
print ["bigger"]
print ["finis"]

 File "<ipython-input-5-ea21dd538df0>", line 2
    if x < 10
             ^
SyntaxError: invalid syntax

pls help Sir

  Upvote    Share

x=5
if x < 10:
     print ["smaller"]
if x > 20:
     print ["bigger"]
print ["finis"]

 1  Upvote    Share

Use space before print

  Upvote    Share

This comment has been removed.

Hi,

There are no day-wise assignments. This is a self-paced course, you can attempt them at your own pace. As you move ahead, you will get lectures, reading materials, assignments etc.

Thanks.

  Upvote    Share

when I type this code:

x = 5
if x < 10:
    print('Smaller')
if x > 20:
    print('Bigger')
print('Finish')

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-32-c9f36e67c24f> in <module>
      1 x=7
      2 if x < 10:
----> 3     print('smaller')
      4 if x > 20:
      5     print('bigger')

TypeError: 'int' object is not callable

this appears

any solutions??

  Upvote    Share

Hi,

Please share a screenshot of your code.

Thanks.

  Upvote    Share

I just copy pasted and the same appears

 

  Upvote    Share

Hi,

It is working fine on my end:

I would suggest you to type it in once again instead of copy pasting it in a new cell. Let me know if it worked.

Thanks.

  Upvote    Share

hi sandeep, i am zaid ,also from IIT roorkee. i found things very similar to coursera michigan university course "python for everyone" by Dr. 'chuck'l.like your examples were same..starting content was same.. here i am expecting many more things. hope things will be good. all the best.

  Upvote    Share

 

Hi

I am trying to run these codes. but it is not giving me the results. I am waiting for it for minutes. I have reloaded the page but still same response. What to do?

  Upvote    Share

Hi Nivedita,

The loop in first cell is infinite which is making kernel unresponsive.

The asterisk(*) shows that it is still in execution.

  Upvote    Share

I am getting "Invalid username or Password" while I am trying to access the Jupyter within the Lab. I have followed the FAQ suggestion and manually entered the credential but still not working.

  Upvote    Share

Hi,

Your credentials have been reset. Please retry it now.

Thanks.

  Upvote    Share

This comment has been removed.

I mean, Why Programing? is only text and no video

  Upvote    Share

Hi Chiranjeevi,

Sorry i could not get you, are you not able to see the video on this slide?

 

  Upvote    Share

Hi Sir,

Where can I find assement for Topic1 beacause I am not able to see next video session?

Thanks

Chiranjeevi

  Upvote    Share

Hi Chiranjeevi,

This is not an assessment slide, in this slide you have to just watch video and understand the concepts in further slides we have asked you to perform.

However notebook is provided in the right hand side playgroumd in case you want try out the things instructor did in the video to get a better understanding.

All the best.

  Upvote    Share

Hi,

jupyter page is always showing as not connected with server. and the commands are not executing. Also in webconsole page i am unable to type & copy paste the pass word.

 

  Upvote    Share

Hi,

Please go through the below link to understand why kernel gets disconnected:

https://discuss.cloudxlab.com/t/explained-code-taking-too-long-to-execute/5304

Also, please share a screenshot of the console. Please note that you may not be able to copy paste text into the console, not all browser supports that.

Thanks.

  Upvote    Share

getting below error

Enter File Name:chiruwordcount.txt
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-d8154ec3ebc9> in <module>
      1 name = input('Enter File Name:')
----> 2 handle = open(name,"r")
      3 text = handle.read()
      4 words = text.split()
      5 

FileNotFoundError: [Errno 2] No such file or directory: 'chiruwordcount.txt'

 

but I have create a file

  Upvote    Share

Hi Cheeranjeevi,

Please check if the file is in same directory in which the notebook is, our default notebooks are under "cloudxlab_jupyter_notebooks" directory.

If the file is not in the same directory please pass relative path in the name.

  Upvote    Share

Hi Sir,

now text file and python note book are in same folder. this time getting another error.

Enter File Name:chiru_word_count.docx
---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-4-d8154ec3ebc9> in <module>
      1 name = input('Enter File Name:')
      2 handle = open(name,"r")
----> 3 text = handle.read()
      4 words = text.split()
      5 

/usr/local/anaconda/lib/python3.6/codecs.py in decode(self, input, final)
    319         # decode input (taking the buffer into account)
    320         data = self.buffer + input
--> 321         (result, consumed) = self._buffer_decode(data, self.errors, final)
    322         # keep undecoded input until the next call
    323         self.buffer = data[consumed:]

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 16: invalid continuation byte
  Upvote    Share

Hi,

This might help you.  https://stackoverflow.com/questions/5552555/unicodedecodeerror-invalid-continuation-byte

Thanks.

  Upvote    Share

Hi, while run this program I am getting this error, both on inside lab and even on my local machine..

File "<ipython-input-4-835ddefd078d>", line 7
    counts[word] = counts.get(word,0)
         ^
IndentationError: expected an indented block

 

  Upvote    Share

Hi Ritesh,

Indentation in python plays a very important role as it is used to identify block of code, so the code inside functions or loops needs to be indented.

Please give a tab space before every line of code in a function or loop blocks.

 1  Upvote    Share

Hi Sachin,

Thanks a lot, and in tutorial you explain as well that Indentation in python is important, I missed it. 

I just wanted to whether the the TXT file is removed from the location as now I am getting error:

-------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-12-f0582e0db6c1> in <module>
      1 name = input('Enter file:')
----> 2 handle = open(name, 'r')
      3 text = handle.read()
      4 words = text.split()
      5 

FileNotFoundError: [Errno 2] No such file or directory: 'clown.txt'

 

Sorry to bother you again... :(

  Upvote    Share

Hi Ritesh,

The repository link is given below slides you have to clone that repository and all the resources must be present there. 

Please use "git clone" followed by url of the repository to clone.

Please make sure you're giving path of file as giving only name would scan only the direcotry in which your code (notebook) is present.

 1  Upvote    Share

Thanks Sachin.

This repository link will have to clone for local machine. But the error I reported yesterday was in Cloudx lab itself. 

The Program which i wrote is this:

name = input('Enter file:')
handle = open(name, 'r')
text = handle.read()
words = text.split()

counts = dict()
for word in words:
    counts[word] = counts.get(word,0) + 1
    bigcount = None
    bigword = None

for word,count in counts.items():
    if bigcount is None or count > bigcount:
        bigword = word
    bigcount = count
print (bigword + "\t" + str(bigcount))

 

After that I did Shift+ Enter and is asked 

Enter file: clown.txt

After executinf this I got this error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-12-f0582e0db6c1> in <module>
      1 name = input('Enter file:')
----> 2 handle = open(name, 'r')
      3 text = handle.read()
      4 words = text.split()
      5 

FileNotFoundError: [Errno 2] No such file or directory: 'clown.txt'

 

 

  Upvote    Share

Hi Ritesh,

Are you sure 'clown.txt' exist in your home directory?

and the repository needs to be cloned here also.

  Upvote    Share

Here Home directory refers to the cloudxlab's home directory.

 

  Upvote    Share

Oh!, I though that Git cone only have to do in Local machine and in cloudxlab is already available. 

So I just did this command 

[riteshranjanec4242@cxln4 /]$ git clone https://github.com/cloudxlab/ml/tree/master/python

fatal: could not create work tree dir 'python'.: Permission denied

Can you check what i dis wrong. Sorry to bother you again and again..

Ritesh

  Upvote    Share

Can you please try git clone https://github.com/cloudxlab/ml

  Upvote    Share

Same error

[riteshranjanec4242@cxln4 /]$ git clone https://github.com/cloudxlab/ml/
fatal: could not create work tree dir 'ml'.: Permission denied
[riteshranjanec4242@cxln4 /]$

  Upvote    Share

Hi Ritesh,

Can you please show me screenshot of error?

  Upvote    Share

Issue was related to permission of the ML folder and now is running thanks!

  Upvote    Share

i am not able to get input file words.txt while coding

  Upvote    Share

Hi,

Could you please tell me which assessment you are referring, and share a screenshot of your code.

Thanks.

  Upvote    Share

Hi, 

started learning course today. 

Installed most of the software on local machine. 
I tried Jupyter given on right side of browser with given username and password. The version is 2.7.5 

How to bring it to latest version 3.8?

 

Regards,

Surya 

  Upvote    Share

Kindly refer this :-  https://discuss.cloudxlab.com/t/i-am-not-able-to-use-python3-in-the-console/3279/2 

 

  Upvote    Share

Hi. I have completed alsmost 1 hour of course

it still shows 1% completed. Pls guide

 

  Upvote    Share

Hi Guruprasad,
We measure the completion percentage by no. of slides. The duration of the videos doesn't matter.
Also, please mark the slide as complete or submit the answer if there is any assessment to perform.

  Upvote    Share

Hi,

Would request you to restart your server by following the steps from the below link:

https://discuss.cloudxlab.com/t/im-having-problem-with-assessment-engine-how-should-i-fix/3734

Thanks.

  Upvote    Share

I'm unable to run the code

 

  Upvote    Share

Hi,

Could you please elaborate a little more on the issue? Are you getting any errors? Could you please share a screenshot?

Thanks.

  Upvote    Share

hi sir,

1.How do we delete the cells?

2.WHy we haven't used inverted commas with n?

  Upvote    Share

Hi,

1. You could delete cells by clicking on the scissors symbol below the edit option on your Jupyter notebook.

2. Inverted commas are used to denote strings.

Hope this helps.

Thanks.

  Upvote    Share

Thank you

  Upvote    Share

Hi sir,

I am getting 'smaller' in the program end as output without finish. Is that Ok? 

  Upvote    Share

Hi,

Could you please attach the screenshot of your code and the exact problem?

Thanks.

  Upvote    Share

hi,

Well that was because of indentation.Sry.

  Upvote    Share

ee=input("Europe floor")
print("US floor", int(ee)+1)

 

it is showing type error

  Upvote    Share

Hi,

input() always returns a string. In the next line, the str is being converted into an int. You could only add a number with a number but it is not possible to add a number with a type. Hope the error is due to this. If not, please attach a screenshot of your error.

Thanks.

  Upvote    Share

Hi,

Please share a screenshot of your code and the error that you are getting.

Thanks.

  Upvote    Share

Hi sir,

How do i get codes in repository? pls help.

  Upvote    Share

Hi,

Here is the link to the codes:

https://github.com/cloudxlab/ml/tree/master/python

Please use the following command on a web console that you need to open through My Lab to clone it into your lab:

git clone https://github.com/cloudxlab/ml/

Thanks.

  Upvote    Share

Hi sir,

Can't we download the slides for future reference? 

  Upvote    Share

Hello Anuradha,

You can download the slides by opening it new tab - This can be done by clicking the below icon on the slide view

Regards,
Himanshu

  Upvote    Share

Hi,

1. how do i set the python3 as permanent, each time I am logging in it is going back to python 2

2. Is there any live session planned in near time other than this recorded session?

 2  Upvote    Share

Hi,

1. You cannot set the Python3 kernel permanently, however, it should reflect Python3 by default. Could you please share a screenshot of the same?

2. As of now we do not have any live session planned for Python.

Thanks.

  Upvote    Share

Hi. The codes which are shown in the video. How can i copy that. I am watching the recorderd session. Please help. I have enrolled to this course 5 days back but i am still struggling with it

  Upvote    Share

Hi Anirudh,

The code repository link is given below slide.

  Upvote    Share

Hi
I have below question to ask.
Everytime i hit shift+enter i am not getting the output. Please help

 

  Upvote    Share

Hi, Jyothi. 

In this situations, check your internet connnections! or  Kindly delete the cells and restart your server from the right hand side or

All the best!

  Upvote    Share

Hi,

Thanks for your responce.

I am still facing the same issue even after deleting the cells..

  Upvote    Share

Hi Jyothi,

Are you still facing this issue?

  Upvote    Share

Hi Team,

I cannot run the Notebooks form the adjacent Playground tab. I tried re-logging in, rebooting "My Server". Though the notebooks open in a seperate tab, but having it in the same tab is really cool. Expecting a solution/suggestion from your end.

Thank you.

  Upvote    Share

Hi,

The notebooks on the right side of the split screen are default notebooks identified by the assessment engine, so you will not be able to replace them with any other notebook.

Thanks.

  Upvote    Share

Hi,

None of the notebooks are opening adjacently, they are opening in a new tab.

Thank you.

  Upvote    Share

Hi,

As I said in my last comment, you cannot open a new notebook on the right side of the screen. However, there should be a default notebook there, if it's not, please let me know and share a screenshot. I would help you with that.

Thanks.

  Upvote    Share

Hi,

Please use the rsync command from the below link and refresh your page:

https://discuss.cloudxlab.com/t/im-having-problem-with-assessment-engine-how-should-i-fix/3734

Thanks.

  Upvote    Share

sir, kindly share the link for Anaconda 

thanks

  Upvote    Share

Hi,

Do you need to link to Anaconda to install it in your local computer, or do you need to link to our Jupyter notebooks?

Thanks.

  Upvote    Share

for my laptop

thanks

  Upvote    Share

Hi,

Please find the link below:

https://www.anaconda.com/

Thanks.

  Upvote    Share

x = 14
if x <= 10:
    print("Smaller")
if x >= 20:
    print("Bigger")
print ("END")

 Why is this code only excutred the result: "END" for the input of 14 or even 7?

  Upvote    Share

Hi,

Please share a screenshot of your code along with the output that you are getting.

Thanks.

  Upvote    Share

Why is this code only excutred the result: "END" for the input of 14 or even 7?

  Upvote    Share

Hi,

When you input 14, it is printing END because it is satisfying the conditions of your code. When you input 7, it is printing END because you have 2 print statements in 1 cell, so the code is displaying only the last one instead of printing.

Thanks.

  Upvote    Share

[sangitamandal952639@cxln4 ~]$ export PATH=/usr/local/anaconda/bin:$PATH
[sangitamandal952639@cxln4 ~]$ source activate py36Could not find conda environment: py36
You can list all discoverable environments with `conda info --envs`.

hi, this is the error i am getting when i am trying to open python 3 on the console provided right next to the lesson. kindly help. how do i proceed if i am unable to open python

  Upvote    Share

how to open python on lab

there is jupyter on right side guide me

  Upvote    Share

Hi,

I already replied to your previous comment, please check.

Thanks.

  Upvote    Share

Hi
I have completed 2 topics(basics). where can I find some exercises for practice?

  Upvote    Share

Hi,

The first coding assessment comes at item# 20. We do have questionnaires before that where you can test your newly acquired skillset.

Thanks.

  Upvote    Share

where to find the assement panel?

  Upvote    Share

Why this is not giving back any result?

 

  Upvote    Share

You probably have some long running cell that has not finished processing. So its is not letting your other cells to proceed. Try restarting your notebook and try running the cells again.

  Upvote    Share

The loop is unending. 

It should be:

 

n = 3
while n > 0:
   print(n)
   n = n -1
print('Blast Off')

The n = n-1 should be part of the while loop - see the indentation.

If you keep that outside, the while loop will keep on learning

 1  Upvote    Share

Typo: it should have been
If you keep that outside, the while loop will keep on running.

  Upvote    Share

So where are the exercises where we can practice?...Im on topic2 and i see on the second slideboard, there\s one exercise and three, four questions. Are those the exercises? And on the main Menu, some have projects, some don't. The topic with projects are these exercises i pointed out on the slides? Please clarify. Thanks!

  Upvote    Share

Sorry..correction. Not Topic2 but no.2 learning item of Topic1.

  Upvote    Share

Hi,

The first coding assessment comes at item# 20. First we will get up and running on how to code in Python before giving you the first coding challenge.

Thanks.

  Upvote    Share

U mean learning item 20 of topic1? Then what are those with XP points? Are those not assessments? Im confused. Please mention how many assessments or projects need to be done in order to get 60% course progression?

  Upvote    Share

Hi Suranjana,

XP points are not assessments. Assessments are learning items where you would be asked to code. I would suggest you start from topic# 1, learning item# 1, and then move forward from there. 60% of course progression does not depends only on projects or assessments, but also on the completion of lecture videos.

Thanks.

  Upvote    Share

Thanks for the clarification.

  Upvote    Share

Hello,

 Is it possible to download the recording for future study?

  Upvote    Share

Hi,

You will not be able to download the videos. But you don't need to since you have a lifetime free access to the videos and other courseware.

Thanks.

 1  Upvote    Share

Ok, Thank you

  Upvote    Share

Raj,

Again and again, I'm facing difficulties, kindly shorten the resolution time so that I can use my time efficiently , I've other stuff to do as well. I can't devote my full day in this job of typing the error to you, In fact, I can do completion of the task in the course but not this anymore, Sandeep Bhai pls help...

I hope u can understand now. It's really very very difficult to invest resultless time into it. I'm not sure how you've thought to design this course which is that much cumbersome to candidates,,,, I'm not at all from IT background nor PRO like you,  but I've to be the one so pls help. Last update was in 2018 ,,, n we're practicing today ......

 

  Upvote    Share

Hi,

You need to provide the full path to the file.

Thanks.

  Upvote    Share

How to get the similar result like shown in the video, I'm facing file error, pls check and lemme know if I need to be in the same dir to call the file as similar to Unix/Linux or how to see and check the files which are existing in this module, etc, what's the concept behind it??? because without hands-on, the session n video is useless, pls reply asap, again I've wasted my 2 hrs in just a single small thing, why not u r making full-proof assistance to help candidates

 

 

  Upvote    Share

Hi,

You need to provide the full path to the file.

Thanks.

  Upvote    Share

This comment has been removed.

Hi raj,

how to reach here if I landed somewhere else. 

 

  Upvote    Share

Hi Kranti,

Just refresh the page and default notebook will be open automatically.

  Upvote    Share

Sachin, okay kewl, thanks. well, I'm at section 2/134, watching recorded videos of Sandeep Bhai,

1. he wrote some codes while explaining, how would I get those to practice with him and progress accordingly, in fact he said he'll share them but where, pls share the details how to get them.

2. each video might be of 2 hrs around, I'm just expecting, I haven't check all the section so in my wild guess 2x 133hrs to complete python, like that we've around 10 more self paced courses so imagine how much time we need to complete them along with weekend 3 hrs of different classes.... pls put some light how to proceed in order to achieve the best study / course and overall result.. I'll definitely do all course n each sections but what strategy I can follow to match my learning from both ways self-paced courses n classroom (zoom) sessions...

  Upvote    Share

While executing my python script I am getting following error in cloudxlab jupyter:

[nameeraer992786@cxln5~]$ python3 hello.py
bash: python3: command not found

 

  Upvote    Share

Hi,

This is because the default Python installation on our lab is Python 2. To access Python 3, please follow the steps given below:

export PATH=/usr/local/anaconda/bin:$PATH
source activate root

Thanks.

  Upvote    Share

i was trying to execute about the coding which was given under the 'type matters' part.But i got syntax error.

could you please exaplain about that part?

 

  Upvote    Share

Hi,

Could you please share a screenshot?

Thanks.

  Upvote    Share

Hi,

I was trying to test the code for the wordcout in a file and the following error occurs

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-17-2c4e3b8d62a5> in <module>
----> 1 handle=open(name,'r')
      2 text=handle.read()
      3 words=text.split()

FileNotFoundError: [Errno 2] No such file or directory: 'myfirstfile_copy.txt'
???????
However, I have a file with the name and text in it, how do I specify the path? (the file is saved in the cloudxlab root folder itself). Please advise

 

 

 

 

?

 

  Upvote    Share

Hi,

This is a part of which assessment?

Thanks.

  Upvote    Share

It is not an assessment it was part of the explanation video, so was trying the same.Thank you

  Upvote    Share

Hi,

We do not have provision for manual assessment code. Would request you to post this in the discussion forum for peer feedback.

Thanks.

  Upvote    Share

Hello Sheny, you need to put your file inside "cloudxlab_jupyter_notebooks", then it should start working.

 2  Upvote    Share

Thanks brother. I was having the sam eproblem.

  Upvote    Share

Thank you

  Upvote    Share

I feel, you are very slow

  Upvote    Share

Hi,

Are you facing any challenges with this?

Thanks.

  Upvote    Share

Hi,

Is there a block comment ?

  Upvote    Share

Hi,

Could you please tell me what do you mean by block comment? Are you referring to multi-line comments?

Thanks.

  Upvote    Share

While executing my python script I am getting following error in cloudxlab jupyter:

[manideol905781@cxln4 ~]$ python3 smiple.py
bash: python3: command not found

  Upvote    Share

Hi,

You do not need to use the command line, we have provided you with Jupyter notebooks to complete all your assessments. If however, you would still like to try, follow the below set of commands:

export PATH=/usr/local/anaconda/bin:$PATH
source activate root

Thanks.

  Upvote    Share

"you are requesting a page that does not exist!", getting this message on notebook panel. any fix?

  Upvote    Share

the saved files are opening in the new window, though.

  Upvote    Share

Hi Abhinav,

The 'Pyhton.ipynb' notebook which is the default notebook for this assessment is not present in your direcotry.

Please create a new notebook in directory 'cloudxlab_jupyter_notebooks' with name 'Python.ipynb', you can do this by going to files tab in jupyter.

  Upvote    Share

If in pythn file identataion are messed up, how can be fixed?

  Upvote    Share

Go through each line and correct the indentations. Indentations is what defines scopes in Python. If you have incorrect indentation, the scope of your variables will be incorrect.

In my opinion, if you have many lines of code with incorrect indentation, try breaking the lines of code into chunks and fix one by one. 

  Upvote    Share

How does a comments ends is it with ent ter or next line

like # i need to comment 2 lines

second line ..............................

for commenting second line i need to add # again right?

  Upvote    Share

Hi Kshitiz, 

There are multiple ways to comment multilple lines.

Usually i camment using triple quotes

''' this
is 
comment '''

  Upvote    Share

if we type 

>>> type(1)

so it should give an output like this,

<type 'constant'>

  Upvote    Share

Hi,

Please note that constant is not a datatype. The type() command gives you the datatype, which in this case would be int.

Thanks.

  Upvote    Share

if we type 

>>> type(1)

so it should give an output like this,

<type 'constant'>

  Upvote    Share

Trying to run the command 

n = 1200
while n > 1 :
    print (n)
    n = n / 2
    Print("Good News")

output 

1200
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-59-fe08e32e8590> in <module>
      3     print (n)
      4     n = n / 2
----> 5     Print("Good News")

NameError: name 'Print' is not defined
  Upvote    Share

because it is case sensitive.

  Upvote    Share

change Print("Good News")  to print("Good News") . P is in caps here 

  Upvote    Share

Topic time 1hr 33mins approx->

Related to quoting the character,even this code is also working for me:

1. print("hello\ world")
o/p hello\ world

2. print("hello\\\* world")

o/p  hello\\* world

2nd one gives me two \\ which means that 1st '\' works to quote the character.

  Upvote    Share

Hi,

Please let us know if you are facing any challenges.

Thanks.

  Upvote    Share

Hi Sir,

My Jupyter Notebook is showing blank which is on right  side of the tutorial. How to get it corrected. Please let me know as early as possible.

It is telling your webpage might would had moved permamnenetly to new webpade addess. Please rectify the issue.

  Upvote    Share

Hi,

Could you follow all the steps from the below link and try again:

https://discuss.cloudxlab.com/t/im-having-problem-with-assessment-engine-how-should-i-fix/3734

Thanks.

  Upvote    Share

sir,
where do we get the codes in the vedios?
nd the required resources?

  Upvote    Share

Hi,

The course slides are available for download. You can download them by clicking on the pop-out button on the top right of the slide content.

I hope this helps. If you have any other queries kindly let us know.

All the best!

-- Mayank Sharma

  Upvote    Share

sir it is showing incorrect password in lab please help my id is sandhyacounselor2508

  Upvote    Share

Hi,

I have reset your password, please use the new password to login. Also, instead of copy/pasting the password, please type it in the browser.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

hi.i m trying to run script in console.It says name not defined

  Upvote    Share

Hi, Vinita.

I understand that you are running the code in Python shell.
May I know which code you are running?

In shell there is a chance of indentations error, Kindly look at it. You cam also run then programs in the Jupyter notebook provided.

All the best!

-- Satyajit Das

  Upvote    Share

Hi Sandeep,

This is Siddhartha & i don't have any prior programming language exp. i want to learn Python to do the Automation in my Office Network Environment hence need help in how to proceed from here.
Best Regard's

  Upvote    Share

Hi,

I see that you have enrolled for our Python for Beginners course. As and when you complete each topic, you would understand how Python works, various features of Python, loopholes, how to code with it. Next, you would do a project with that knowledge you have gained, with this project you will get a hands-on experience about how to solve a problem with Python. You can then apply the same knowledge to solve various other problems that you encounter in your daily lives that can be solved with coding.

Happy learning!

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Thanks a Lot..!!

  Upvote    Share

Hi

I am new to python. When try to run the script in web console. I got this error. Here is the screenshot for your reference.
Also please let me know how can i run the script in anaconda prompt.

  Upvote    Share

Hi,

Would request you to use the Jupyter notebook to run all Python codes.
Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi
I tried to run the code as in the video. But the following error came up.

.

  Upvote    Share

Hi,

You need to mention the path along with the file name.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

what is the email to ask detailed doubts ?

  Upvote    Share

Hi,

You can drop us an email at reachus@cloudxlab.com.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hello Sir,
What action does function 'dict ()' perform?
Also i had created a variable x=1.3 and assigned a=x. Post which i converted the data type of a from float to integer by int(a). Still the result is presented in float format a=1.3.
x=1.3
print (x)
print (type(x))
a=x
int(a)
print (a)
print (type(a))

  Upvote    Share

Hi Dineshchandar,

The Python dict() is a built-in function that returns a dictionary object or simply creates a dictionary in Python.

Also, there was a small error in your program. You converted the type from float to int of a variable, but you didn't assign it to a variable and technically, you were printing the float value. Here's the correct program. Let me know if you face any issue.

x=1.3
print(x)
print(type(x))
a = int(x) # assigned type int of x to a
print(a)
print(type(a))

Thanks

-- Shubh Wadekar

  Upvote    Share

Thank you Shubh Wadekar.

  Upvote    Share

I am getting below error

Smaller
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-15-1e0341f7f6e4> in <module>
3 if x>20:
4 print('Bigger')
----> 5 Print('Finis')

NameError: name 'Print' is not defined

  Upvote    Share

Hi Avtar,
Python is case sensitive please use small 'p' in 'print'.

-- Sachin Giri

  Upvote    Share

Hello Sandeep Sir and Team,
I am not able to get same value when type exercise in jupyter shown in session 2, not getting correct information.

  Upvote    Share

Hi Disqus,

Thank you for contacting us.
Kindly refresh your page or restart your kernel. You can take help from the following link: https://discuss.cloudxlab.c... Also, the * mark indicates that the code or query is processing. If it's taking too long, then please check your internet connection also.

Please feel free to let me know if you have any queries and I'll be glad to help.

Hope this helps.

Thanks.

-- Anupam Singh Vishal

  Upvote    Share

Dear Sir,

The python file execution statement did not work after trying to find answer in jupiter notebook environment.
#run pythonpractice.py
%run pythonpractice.py
ERROR:root:File `'pythonpractice.py'` not found.

  Upvote    Share

Hi Disqus,

Thank you for contacting us.
Please elaborate. Kindly sent the screenshot of the code you are running and the error you are getting.
Please feel free to let me know if you have any queries and I'll be glad to help.

Hope this helps.

Thanks.

-- Anupam Singh Vishal

  Upvote    Share

Dear Sir
I completed my course Python for beginners 100% before 18-05-2020
but
now its showing 99%
why its happen
i will get certificate or not
please tell me
Thank You

  Upvote    Share

Hi,

Would request you to share your email id with us.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

My mail id
penukulashiva473@gmail.com

  Upvote    Share

Let me know this issue persists.

-- Praveen Pavithran

  Upvote    Share

the below works fine on jupyterlab but fails on anaconda prompt. without the last print it works, some indent issue on prompt
>>> n=5
>>> while n>0:
... print(n)
... n=n-1
... print('hi')
File "<stdin>", line 4
print('hi')
^
SyntaxError: invalid syntax

Please advise

  Upvote    Share

Hi, Kaushal.

Your program is correct only.

You need to give indentations after while. Generally you can use the tab for it.
You can write in Jupyter notebook for simplicity.

Kindly refer the screenshots for your perusal.

All the best!

  Upvote    Share

thank you so much

  Upvote    Share

Dear Sir,

To run python command on unix shell and call file name is not working, can you identify the issues with both the images given.


  Upvote    Share

Hi, Sakti.

In the first image you are running the Python file inside the python shell and that is not the correct way as you can write only the operations in the shell.
Kindly come out from shell and run in your web-console. it will work.
Kindly refer to the screenshots.

All the best!

  Upvote    Share

Hi, Sakti.

In the first image you are running the Python file inside the python shell and that is not the correct way as you can write only the operations in the shell.
Kindly come out from shell and run in your web-console. it will work. Kindly refer to the screenshots.

-- Satyajit Das

  Upvote    Share


I am getting the following error.
Could you please help me out

  Upvote    Share

Hi,

Python uses indentation for block of codes. You need to fix the indentation for the print statement.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Thank You.

  Upvote    Share

Hello Sir,
I am not able to open the Python file on Linux console.
My file name is simple.py i have saved under Jupyter.
but while opening in console,I am getting the file error (No such file or directory)
please help.

  Upvote    Share

Hi,

Would request you to share a screenshot of your directory structure where the file is stored, your console, and the error that you are getting.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi
I create a python file and saved as simple.py . i got below error when i ran %run simple.py

---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~/cloudxlab_jupyter_notebooks/simple.py in <module>
3 {
4 "cell_type": "code",
----> 5 "execution_count": null,
6 "metadata": {},
7 "outputs": [],

NameError: name 'null' is not defined

  Upvote    Share

Hi,

Would request you to share a screenshot of the content of the file, the console, and the error that you are getting.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

how do i get the certificate?

  Upvote    Share

Hi.

By completing 60% of the course and mandatory projects you are eligible to earn the certificate.

All the best!

-- Satyajit Das

  Upvote    Share

Hello sir
I, Prithvi Kaushik, am a student of grade X. I hope to learn a lot from you and this course, and would like to know if I can use the knowledge from this course to program Microprocessors like Raspberry Pi?
Regards
Prithvi Kaushik

  Upvote    Share

Hi Prithvi,
It's good to know that you're interested in programming and started doing stuffs at an early age.
In this course you'll learn how to code in python and create various programs using python which you can use python to create programs for microprocessors.

All the Best ????

-- Sachin Giri

  Upvote    Share

hi sir, i just saved my file named hello.py just like you did hellopython.py but in my console i cannot access it.
what would be the possible error

  Upvote    Share

Hi,

Please let us know how you are trying to access your file. If possible share a screenshot with us.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

hi
When I am launching python in console in lab it is showing python 2.7.5
we are supposed to use python 3 right?

  Upvote    Share

Hi Mrunmayi
In order to use python 3, run the following in console/shell/terminal: export PATH=/usr/local/anaconda/bin:$PATH After this running python will launch python 3.

-- Sachin Giri

  Upvote    Share

i am having problem with creating new text file and run that file on jupytor using cloudx lab

  Upvote    Share

Hi,

Can you please share the specific topic for which you are creating a text file and also can you send a screenshot of the problem that you are facing while creating the file.

Thanks.

-- Mayank Sharma

  Upvote    Share

@disqus_XTh3bUKOBh:disqus, In Python tutorial Sandeep Sir gave an assignment to calculate maximum profit from stock prices of 365 days. I have taken a sample of 8 days stock prices arbitrarily and written a code as below. Pl check if it is correct.

# Say 8 days stock prices are (7, 9, 1, 6, 3, 2, 10, 5)
# creating a dictionary stock values and days
counts = dict()
count = 0
x = 1
for i in (7, 9, 1, 6, 3, 2, 10, 5):
count = count + 1
days.append(count)
counts[i] = counts.get(i, x)
x = x + 1
print(counts)
#swap key, values to keys as days and values as stock prices
res = dict((v, k) for k, v in counts.items())
print(res)
# first find the max stock price and the corresponding day
a = list(res.values())
b = list(res.keys())
c = (b[a.index(max(a))])
d = (b[a.index(min(a))])
p = max(a)
print(c)
print(d)
print(n)
print(p)
# find minimum stock price before the date of max stock price
for m in a:
while m < d:
z = min(a)
print(z)
break
max_profit = p - z
print("max. rate is on day:", c, "& min. rate is on day:", d, "which is before max. rate day, so max. profit:", max_profit)

If its is correct, Pl suggest tweaks if any required in this. Thanks.

  Upvote    Share

Hi,

Would request you to share a screenshot of your code instead.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Screenshots attached ...pl check, if the code is ok. Thanks.

  Upvote    Share

Hi Sanjay,

Have you tested your code? Is it giving you the intended result?

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

how do we put mathmatical constant like pi exp gamma etc.

  Upvote    Share

Hi,

You can use the Python math library for the same. For example, for exponential, there is an exp() function in the same.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Not able to access or run any file in jupyter, though the file exists in files(jupyter).

  Upvote    Share

Hi Sanjay,

Could you please tell me a bit more about your issue, what happens when you try to run a file on Jupyter? Are you getting any error messages? How are you trying to run the files on Jupyter? Could you please share a screenshot?
Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Pl check the attached screen-shot. I created a new text file in Jupyter under Files...named it as 'ml-python.txt' and saved it after adding some text inside it. But I am unable to open the same and the eerror msg is "no such file". Apart from this I also tried running a name.py file created earlier with command : %run name.py....but same file not found msg is coming, though in jupyter I can see that the file exists. As a matter of fact none of files couldbe accessed through open or read commands of python in jupyter python3 notebook. This is strange...Pl help.

  Upvote    Share

Hi,

You need to mention the path where you saved the file to open it.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

I am trying to read a word file. It is giving me error as below:

---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-29-ce24369bef32> in <module>
----> 1 text = handle.read()

~\anaconda3\lib\encodings\cp1252.py in decode(self, input, final)
21 class IncrementalDecoder(codecs.IncrementalDecoder):
22 def decode(self, input, final=False):
---> 23 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
24
25 class StreamWriter(Codec,codecs.StreamWriter):

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 637: character maps to <undefined>

I have tried method open with some parameters like "encode=utf8", "errors=ignore", but still not able to proceed.

Please suggest.

  Upvote    Share

Hi,

Would request you to share a screenshot of your code and the error you are getting.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Please find the below attached screen shot of error.

  Upvote    Share

Hi,

Could you please check the file you are trying to open.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

I have tried again to open a .docx file but not able to read it. See below screen shot:

  Upvote    Share

Hi,

You cannot open a .docx file without some additional libraries. However, you ca try to open a .txt file instead, and it should work.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

HOW TO CHANGE MY PASSWORD

  Upvote    Share

Hi,

Are you referring to your lab password? If yes, then please let us know and we would reset the password for you.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

yes i want give my password

  Upvote    Share

Hi,

Please share your email id with us and we would reset the password for you.
Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi Team,

How can we download Slides used ?

  Upvote    Share

Hi,
There will be a pop-out button on the top right of the slides window. Just clicking it would open slides in a new tab. You can download it from there.
Thanks

-- Mayank Sharma

  Upvote    Share

Dear sir,
when i am installing anaconda in my PC showing attached image error
when i am unable to soling
please share the solution

shohttps://uploads.disquscd... w

  Upvote    Share

Hi Shiva,

We are unable to view the screenshot. Also, we would not recommend using your local Anaconda installation, but rather use the playground so that our assessment engine can automatically assess your solutions.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Thank you for your response.

  Upvote    Share

Hello Sir,
The jupiter notebook of cloudxlab is working very slowly & output is not displaying at all.I have tried the same code in my Pc pycharm it's running very well.

n=int(input("enter the number"))
i=0
while i<n: if="" n="=5" and="" n="">0:
x=n-i
print(x)
i=i+1
else:
print("Blastoff")
break

Sir please let me know is there any option to save the assignments which we are practicing with you in Cloudx online lab because each time I save my work it denotes that "notebook is read only".

  Upvote    Share

Hi, Shivam.

You can download your practice notebook as html file to your laptop. but you cannot continue to write the program in the given notebook as its length will become larger and larger and loading time will be large.

All the best!

-- Satyajit Das

  Upvote    Share

ok thanks

  Upvote    Share

Hi,

Are you still facing this issue? If yes, then please provide us with your email address.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi Sandeep
Could you please mail me some commonly used instructions used for console for windows computer. I know about jupyter notebooks but want to know how to work on console.My mail id is prachisingla914@gmail.com
Thanks
Prachi

  Upvote    Share

Hi Prachi,

This is a good place to start:
https://docs.python.org/3/u...
Other than this, you can search on Google if you are looking for something specific.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi sir,
when i am installing anconda its throwing erro

  Upvote    Share

Hi Shiva,

Are you trying to install Anaconda on the CloudxLab lab or on your own computer? Could you please share a screenshot of the error you are getting.
Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Do i need to have subjective knowledge on numpy pandas sklearn and tensor flow like libraries before starting the course because I am new to all this actually??

  Upvote    Share

Hi Sandeep,
Please provide slides/notes used in the lecture in pdf format.
It would be great if you can send me in mail. my email id : er.krgauraw@gmail.com

  Upvote    Share

hi Sandeep, 2 questions:

1. can you please check if i have a LIVE subscription of 'cloudx and how long
2. i have company based set up for juptyter, should that be enough for completing assighnment or cloudx subscription is must.

please reply asap

  Upvote    Share

Hi, Mohit.

1) You can check it by going to MyLab under your profile pic.
You will find when is the ending date.
2) You have to complete the assignments in CloudxLab so that we can evaluate it. If your subscription is over then you may lose the datasets and folders from the lab.

All the best!

  Upvote    Share

Hi Sandeep,
I my Jupiter lab, by default the notebook (programs) are saved by extension .ipynb
Is there a way to change it to .py ?

  Upvote    Share

Hi prashant,
By default it saves to .ipynb but you can use save as option to save it as .py
But you can't use .py file in interactive notebook cells.

  Upvote    Share

sir my jupiter is showing '500:inter server problem'for two days. How i fix up this issue?

  Upvote    Share

sir, i want to download slides and videos, can it possible

  Upvote    Share

I am not able set python 3.6 from console below is the screen shot , please help

  Upvote    Share

Hi, RK.

Can you please through the below link.

https://discuss.cloudxlab.c...
export PATH=/usr/local/anaconda/bin:$PATH

All the best.

  Upvote    Share

thank you

  Upvote    Share

Sir, Could you please share all the slide in my email jknis123@gmail.com

  Upvote    Share

Hello Abhinav
I just want to know if the code, pasted on collabedit at 1:24:40, is available for us to copy or should we write down by pausing the video.

  Upvote    Share

Hi,
No, We have to write the code. We do not support collabedit as of now.
We use Jupyter for Python code.

All the best

  Upvote    Share

how can i get slides?

  Upvote    Share

in conditional statement why use Colon please explain

  Upvote    Share

Hi - request some content re-arrangement so we can skip relevant sections like very basics of computer programming etc. This mode of scrolling through a 3 hour video is not helping to know whether one skipped anything important or not. I am fairly comfortable with programming, and completed this video within 1 hour only, but for others it makes sense to make smaller videos and do this.

  Upvote    Share

Hi ,
I am getting an error on running the command py36, please help me out if this is a problem

[kumartanya12342383@cxln4 ~]$ export PATH=/usr/local/anaconda/bin:$PATH
[kumartanya12342383@cxln4 ~]$
[kumartanya12342383@cxln4 ~]$ source activate py36
Could not find conda environment: py36
You can list all discoverable environments with `conda info --envs`.
[kumartanya12342383@cxln4 ~]$ python3
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux

Thanks.

  Upvote    Share

Hi, Tanya.

There is no need to activate the py36 source as it is already activated.
Please refer to the screenshots attached!.


You should be able top do it!

All the best!

  Upvote    Share

I checked the env and it was giving base as env option. So, I activated base env and then used python3. However, checked python3 directly works also. Could you please confirm why do we need use source activate py36 (I used base instead of py36) to connect and how it is different from connecting directly to python3 interperator at console?

  Upvote    Share

We have installed Python 3 in py36 environment

  Upvote    Share

Sir I want to access all the slides and GitHub repository on my email account
manojdhumal24@gmail.com

  Upvote    Share

how can i upgrade pyhton 3 on cloudlab

  Upvote    Share
Abhinav Singh

This discussion will help you https://discuss.cloudxlab.c...

  Upvote    Share

as you mentioned above this link i found this kind of info

  Upvote    Share

sir i enroll this course two days ago how can i run this code on jupyter and where is the code link?

  Upvote    Share
Abhinav Singh

Hi @manoj_dhumal:disqus

Which code are we talking about? You can see the Jupyter notebook on the right hand side. We can right the code in the notebook

  Upvote    Share

I am getting attached msg

  Upvote    Share
Abhinav Singh

This discussion will help you

https://discuss.cloudxlab.c...

  Upvote    Share

Hi All,
print('finish')
print("finish")
both statement generate same o/p.
as in java 'a' is character and "A" is String.
what about Python ?

  Upvote    Share

Hi, Ranjeet.

In Python either ' ', " ", ''' ''' , single string, double string or triple string all are strings only.

All the best

  Upvote    Share

Do we have multithreading in python, just like java?

  Upvote    Share

Hi, Ritika.

Yes, you are right. You do have the Multi-Threading concepts in the Python.
Threads are the Light-weighted processes and they do not require much memory overhead and they are cheaper than the processes.

You can make a process by :-
--> thread.start_new_thread ( function, args[, kwargs] )

All the best.

  Upvote    Share

Hi Sandeep, Does Python support Garbage collection similar like Java as OO support the same.

  Upvote    Share

Hi, Dhirendra.

Yes, in Python there is a well defined concept of Garbage collections. you have to clean your objects by yourself.

In python, if you want you can delete objects manually by using del "variable_name".

All the best.

  Upvote    Share

His sir, can you please send me the slides at navjotsinghsodhi52@gmail.com

  Upvote    Share

hello Sandeep, I am not able to run the program which i saved in jupyter book in unix console.

  Upvote    Share

please provide the slides related to the whole course .
email id - ashishghule1993@gmail.com
thanks in advance

  Upvote    Share

Please go thru the course. The corresponding slides are already attached in the course learning items.

What do you plan to use them for? Do you want to teach using these slides?

  Upvote    Share

For offline learning purpose

  Upvote    Share

Please provide me all the slides related to this course. Please email me on rajesh.thumma88@gmail.com

  Upvote    Share

Please provide me all the slides related to this course. Please email me on vinayshetty1989@gmail.com

  Upvote    Share

Sir i want all the slide, Please share me in my email-id skbehera.iit@gmail.com

  Upvote    Share

-- Please reply above this line --

Sure Sandeep, will do that.
--
Best,
Shweta Kaka
support@cloudxlab.com

  Upvote    Share

Hi Tarun,
please also share the slides on "shreeom.sharma@gmail.com.

regards,
shreeom sharma

  Upvote    Share

Sir I want to access all the slides and GitHub repository on my email account
priyerock@gmail.com
I am thankful to u sir.

  Upvote    Share

Please clone the repository of CloudxLab on GitHub.

  Upvote    Share

Hi, How to download the PPT?

  Upvote    Share

how to download the ppt?

  Upvote    Share

Hi, could you post the slides of session 2 for our reviewing? thanks.

  Upvote    Share

Hi, how to get explanation of the following functions programs for python .../
? split
? get
? read
? items

  Upvote    Share

Hi Bintao, Thanks for your question. To get help for using a function in Python you can use the Python's help() function.
It displays the docstring defined in the function. So for getting help in
using split you can simply open the console and after starting Python
type help(str.split), since split operates on a string object. So for
get() use help(dict.get), for read use help(file.read) and for items use
help(dict.items).

  Upvote    Share