i'm pretty new in using Python and PyCharm so I'm looking for a little help here. Maybe this question can sound stupid for you, but trust me I'll be very happy for every answer I got here.
This is my code in PyCharm. I wanna make something like the Mad Libs program (is that really a name of it?) and I'm currently trying to find a way where program can figure out favourite color of User, haha. I copied the procedure which is working with numbers, but looks like words are very different.
error screenshot over here
Hopefully you can understand my weak english and my funny problem.
Thank you so much!
- Alice <3
The problem in your code is on the following line:
answer2 = int(input("My best color is "))
You are trying to cast the user input to integer. This means that you are trying to 'convert' a string like purple in a number.
This raised the error that you can see in the console.
In order to fix it, you can use the following command instead:
answer2 = input("My best color is ")
Thank you Giordano! That helped, I also had to change:
if answer2 != fav_color:
to
if answer2 == fav_color:
Related
Is there any way of drawing something like this automatically?
If yes please tell me, thanks
As fas as I know, there are plenty of online ascii art generators. Here's one that I've used a few times:
https://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20
You would copy it from the browser and paste it in the comment in the code.
So I am a beginner competitive coder who just started using NeoVim after using gVim.
So when I copy sample test cases from lets say : Codeforces or Hackerearth.
For instance if the sample text is :
5
RRGRR
Then when I use Ctrl + C to copy from the website and then I paste it in the inbuilt terminal the code is now formatted in a different way as: 5RRGRR
So now the spaces and new lines are removed hence the answers I get are wrong.
Please help me correct this.
This is my first question I have asked so please forgive me for any mistakes I have committed
I have previously tried to use the
:set paste
in NeoVim but even that does not seem to solve my problem.
(I'am a windows 10 user)
Try using ctrl-v instead of p... that works for me
I'm actually starting creating a small language (in vb net, yes I know, maybe not a good idea).
I already started learning tutorials about regex, but apparently this function is saying me to get out).
I want to add some kind of commands, such as a command that allow you to arg. a /print command, something like:
/PRINT["Hello world";"blue";propety:{bold;italic}]
So, for me, the regex is :
"{{^\^{\|^#\^~\{}~\^]|\~^[}^\}^#~\[}~^\}^##{\~{^}^#\#~#}\^#}^]|\|}]#\|{"
So you understand that's not something I like writing.
Would you show me how to construct regex code for the first command I let?
Regex alone isn't the best way to create a language that, well, actually works.
Read this article for more info. I'm sure you can find better way to write a language if you really need to write it. In vb.net...
Anyway, if you insist on writing it in vb, I found a video that will help you with it.
At Uni, we are using MAGMA. I'd like to create a log file. That should be done with SetLogFile('FileName'). The result of that, however, is User error: Identifier '20.10.txt' has not been declared or assigned (FileName being 20.10.txt). Also, load 'inputfile.magma' seems not to work. I'm working on Mac OS X 10.7.5. Why do those things happen and how do I solve these problems?
OK, it's a damn basic mistake, and I apologize, but if someone who is (or should be) supposed to teach you at least a bit of MAGMA doesn't tell you strings are delimited by double quotes "" and not signle quotes '' in MAGMA, how exactly are you supposed to guess you should write SetLogFile("20.10.txt") after a semester of MATLAB where strings are delimited by '' and so you would have '20.10.txt'? I sort of found out by myself, and then tonight, in the middle of a web search, I realized that of course, double quotes, and wondered if he is supposed to teach us MAGMA or only to show us random examples of MAGMA usage with no other purpose whatsoever. As for the load thing, I will check that is the right name and come back with either an edit to this or a follow-up, or nothing at all, since the name was from memory and might have been deformed.
I have a simple question (that I don't seem to be able to answer),
I am a new VIM/Linux user, and since I do c++ development I decided to install the C.VIM plugin to speed up my development time. The problem is, it says in the plug-in (c++) menu that to do a switch statement I have to write \ss (for me the leader is ",", so it's ",ss") but when I do this it just puts me in insert mode and nothing happens. I know the plugin is well set up because when I open a new c++ file it generates a comment box where I can give the description of the program.
I would love it if I would be able to use the shortcuts, because using the menu just losses the point of using vim.
Oh and please, just keep in mind that I am new to vim, I still have hard time figuring out what means <c-r> + TAB (which is, if i'm not mistaking "ctrl-r <tab>"), so if you could just try to explain the solution clearly without to much jargon I would appreciate it. (while i'm here, does anyone know of a good vim tutorial where I could understands all of the vim jargon, thanks!)
I appreciate all the help.
I use this cheat sheet:
http://www.worldtimzone.com/res/vi.html
Please add the below line to .vimrc and
helptags ~/.vim/bundle/c.vim/doc
Note: I have pointed to my c.vim doc and I use bundle, it may differ for you :)